Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    PHP






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Mysql Joins


I have created two tables. In one I keep user informations like:

User_id,
User_name,
User_email,
User_IP.

In second table I keep message information like:

email_id
email_text
email_sender_id
email_receiver_id
email_date_id
email_title

I want to join these so that it shows like these result:
email title --- email date --- email from --- email to --- email text




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
MySQL Inner Joins
Working on my final project for a PHP college course. I am working on a shopping cart at this point. I am hacking the script which came with my text book to make it work with my db. Code:

View Replies !   View Related
Using JOINs In MySQL Query
I have a set of database tables. three contain user info, event info and fee info one table contains the id's linking user to event one table links fee's to events one table links users to fees:

I'm thinking this might be a little too complicated and maybe I should just have a fee field in the events table although not all fees are associated with an event and not all events have fees. In fact less then 5% of the events have fees. So the way I have it is probably best. Code:

View Replies !   View Related
Mysql Joins Returning Null
I dont know how to explain it so ill show you the code

$select=$q("SELECT UserExp.CrimeExp, User.Nerve,  CrimeList.ExpNeeded, CrimeList.ExpGain, CrimeList.ExpLoss, CrimeType.Nerve FROM UserExp,User,CrimeList,CrimeType
where CrimeList.CrimeID=CrimeType.ID AND CrimeType.ID='$_GET[type]'")or die(mysql_error());
$select=mysql_fetch_array($select);
$Test=$select[User.Nerve];
$Test2=$select[CrimeType.Nerve];
echo("Test: $Test Test2: $Test2 ");
if($select[User.Nerve]<$select[CrimeType.Nerve]){
Basicly there both returning null, any advice in getting around this problem

View Replies !   View Related
MySQL: Searching With Joins Or Delimited List
I'm trying to implement a solution where a given company can set a list of the coutries in which it has branches.

My first thought is this:

'company' (id, co_name)
'location' (id, co_id, loc_code)

And when the customer want to know if a company has a location in Belize:

select c.co_name from company c left outer join location l on l.co_id = c.id where l.loc_code = 'BZ'

My second thought is adding loc_code to company: Code:

View Replies !   View Related
Joins
I'm trying to figure out how to create my join so that only records with a matching date_id are returned. Here's what I have so far:

$sql6 = "SELECT * FROM team_members LEFT JOIN team_members_x using (team_id)";

The team_members_x table has a date_id field that relates to a third table called 'dates'. Later on, when I attempt to put the values from $sql6 (now called $result6) into a <select> form box using the following code, I run into problems which I'll describe below:

while ($row = mysql_fetch_array($result6)) {
$team_id = $row['team_id'];
$date_id = $row['date_id'];
$team_fname = $row['team_fname'];
$team_lname = $row['team_lname'];

if ($team_id != NULL) {
$option_block6 .= "<option value="$team_id" selected="selected">$team_fname $team_lname</option>";
} else {
$option_block6 .= "<option value="$team_id">$team_fname $team_lname</option>";
}
}

I'm not getting what I want. What i want is one value from each entry in the team_members to show up with only those members that were previously chosen for this record to be highlighted in the list. However, what I'm getting instead is multiple entries for each team member with each team member multiply selected. Am I doing something wrong with my join syntax? Or is the problem with my while loop?

View Replies !   View Related
Inner Joins
OK I may be doing this completley wrong but is 'seems' ok but I only get one row back
the JOBLOGS table just contains userID,Date started, date finished, jobID the other tables contain more details about the taks or project Code:

View Replies !   View Related
Joins VS Subqueries
Can anyone please tell me in which cases sunbqueries are efficient than
joins and vice-versa? I googled about it. Few sites informed that subqueries are efficient than joins only "When the sub-query contains one or more aggregates".

But most of the sites ensured that joins are efficient than subqueries
in most of the cases.

I am assuming like this:

When we have small database,better to use jojns instead of subqueries.
Because,join performs combining of all possible columns(since we have
small database), then applies join condition, then filters and shows the results.

When we have large database,better to use subqueries instead of joins.
Because, Joining of corresponding columns and then filtering is not
efficient with large database.

Is my assumption correct?

View Replies !   View Related
Joins Of A Sort
I have two tables. 

1. with a list of airports, and their codes.
2. with a list of flights, with flight data and airport codes.

I have a query which is working fine in gathering all the flight information from table 2.  Now, when i post the data in a table, i want to show the name of the airport, however, in table 2, it doesn't contain the name of the airport, only the airport code.

I want to get the airport name from table 1, while still maintaining the error free query that i have mentioned above.

I've tried the Select `table1`.*, `table2`.* from `table1`, `table2` where Working query AND `table1`.airportcode = `table2`.aircode order by what-ever.

and try to post the data from table 2, but i get no results where as before i got some.

View Replies !   View Related
Joins - Three Tables
the SQL syntax to join three tables. tableA contains a column 'aLocation' which I need to look up in 'bLocation' in tableB. tableB also has a colum 'bDistrict' that allows me to look up other data in tableC.

How can I do a SELECT on tableA joining to tableB and in turn, looking up the correct row in tableC? There is a possibility of null fields in the 'aLocation' column of tableA.

View Replies !   View Related
Query And Joins
So im having a little trouble understanding how to deal with this query I have two tables:

qualityadmin:
qualityadmin_id (auto_increment - this is my primary key)
authority_body
address1
address2
etc

and

activity_participant

activity_participant_id
refno
qualityadmin_id
activity

what is supposed to happen is that the participant fills in a form that populates part of the qualityadmin table. The participant can choose one or activities from a list box. These choices are recorded in activity_participant table. My question is how can I run a query that shows all authority_body's that have an activity of X (e.g. Government & statutory) Does this make sense?

View Replies !   View Related
Tutorial On Joins
I keep hearing about joins and seeing them mentioned in the posts, but I'm afraid that they still don't make any sense to me. Can someone point me to a book or tutorial on the subject? Would I look in the PHP manual or a database book?

View Replies !   View Related
Table Joins
I have an activity table which has A_ID (PK), C_NUMBER (FK), A_DATE, A_DESC, and a MEDIVAS field. When I perform a search by date, all the dates in that column show up in a combo box, when a cerrtain date is selected, I'm trying to output all the info for that activity (description, medivas) as well as the coresponding company information (C_NUMBER) would be its unique identifier.

View Replies !   View Related
Using Joins Effectively.
Basically, i am trying to display data received when i query using Joins. Basically i am bringing back client info, there is only one of these and I am then Joining two other tables on the client_id.

I c an bring back data fine, even quite impressed, the only problem is how do i get to the second, third etc returned rows of the of the other tables.

I mean, there is only one client, but the history and contact tables have multiple rows with the same id. Code:

View Replies !   View Related
Understanding JOINS
My admin roster I can click on his name to pull up the editsoldier page but none of his data is there because it can't match the weapon_id. PHP Code:

$result = $db->sql_query("SELECT * FROM " . $prefix . "_milpacs_members mm JOIN " . $prefix . "_milpacs_units mu  JOIN " . $prefix . "_milpacs_weapons mw WHERE mm.uniqueid ='$id' AND mm.unit_id = mu.unit_id AND mm.weapon_id = mw.weapon_id");.

View Replies !   View Related
Database Design JOINS
I have a table called courses with the following fields:

Coursecode (primary key & auto_increment), briefdesc, aimed at etc

I have created another table called courseaims:

Courseaimid (primary key & auto_increment) coursename.

One course has many courseaims. In my form that inserts/updates courseaims, I currently have a dropdown field which searchs for all the coursenames in the table coursename. An insert is then made but here is my problem.

As it stands I am adding lots of courseaims for one course but as a result the field coursename in courseaims table has lots of instances of the same coursename. This is a waste and I can normalize this surely. How can I improve this situation and if JOINS are a solution-which type.

View Replies !   View Related
Table Joins Output
I've been thinking a bit about how to handle result sets when you join tables in one-to-many relationships. Let's say we have a users-table, and a messages-table. The users-table has a one-to-many relationship with the messages-table. When you join them, you get something like this as a result: Code:

+--------+----------+-----------+---------+
| UserID | UserName | MessageID | Message |
+--------+----------+-----------+---------+
| 1 | Bob | 1 | Hi! |
| 1 | Bob | 2 | Hello! |
| 1 | Bob | 3 | Wow! |
| 2 | David | 4 | Hey! |
| 2 | David | 5 | Hey you |
+--------+----------+-----------+---------+

Now, if I want to display this, and only show the username one time, what is the best way of doing this? Should I store the user id in a temp variable, and check in the loop if it has changed, or is there a more convenient way of doing this?

View Replies !   View Related
Joins/Advanced SQL Concepts
I'd like to learn some advanced SQL concepts so that A) I understand them here on the board (if you notice, I tend to stay away from the DB forum ) and B) when the need arises, I can use them without hesitation. what type of data/database structure might be good for learning joins and more advanced SQL concepts?

What I mean is this right now, I have no databases that use joins, nor can I think of any that will allow me to experiment with joins effectively. So what types of databases would be good? Like: library (check in/out system, reference books in one table and checked out in another), company, etc. I'd obviously be putting in some fake data so I can try to learn more about them.

View Replies !   View Related
Joins And Same Field Names
What do do when you have some Joins in your sql and databases with similar field names. How do i make a distinction between the ones with the similar names. EG: PHP Code:

$sql = "SELECT c. * , f. * , l. *
FROM csite_companies c
LEFT JOIN csite_filerefs f ON ( c.id = f.compid )
LEFT JOIN csite_locations l ON ( c.id = l.compid ) WHERE
LIMIT 0 , 30";
$recordset = mysql_query($sql) or die(mysql_error());
$count = 1;
$count2 = 1;
        while ($results = mysql_fetch_array($recordset))
                    {
                             if($count2==1) {
                             $company['id'] = $results['id'];
                               }

Problem being that all 3 tables have an id field and i want the one from the company table.

View Replies !   View Related
Make Joins Quicker
I'm making a search engine and i am using joins for the search. 'search_keywords' are the keywords the engine is looking through.

'search_keyword_reference' is a table with an urlID and a keyID to bind the keywords with the urls in the database. Code:

View Replies !   View Related
Results On Table Joins
I have a query that is basically this: Code:

SELECT count(*)
FROM table1 as t1
LEFT JOIN table2 as t2 on t2.foo=t1.foo
group by t1.bar


The basic information is in table 1, but I need additional information from table 2. The problem is that there may be more than one row in table 2 with the same "foo". The difference is that only one item would be flagged as active. I can't just do WHERE t2.status=1 (active) because this is a historical report and we may need to count those that are inactive.

I also can't change the field that I group by because even though I am joining on one field, I need it grouped by "bar". Is there any way to change the join statement so that it will always only pull one record from table 2? If there is more than one, it should only pull the active one.

View Replies !   View Related
SQL Statement W/ Multiple Inner Joins
I have a page where a visitor clicks on a link that takes them to a detail page. The details are displayed based on a key called RegNo. Code:

View Replies !   View Related
Issue Parsing Joins
Im having some problems with parsing a join with the query below. Both tables have a id field but i need the id from the articles field for the link to content.php. Query:

SELECT * FROM `cs_articles`JOIN cs_categories ON cs_articles.category = cs_categories.alt_id ORDER BY `cs_articles`.`id` DESC LIMIT 0 , 5

Tried using mysql_assoc: PHP Code:

echo ['cs_articles.id']

View Replies !   View Related
Paginating Data W/ Inner Table Joins
I'm having some trouble paginating data using an inner table join. I know that the query for a standard pagination would look something like this... PHP Code:

View Replies !   View Related
Rewriting The Query-trouble With Joins
a. I have a customers table ( structure - cid, cgid and company).

b. Multiple values of cid can have be linked to a single cgid but cgid is a value that occurs only in the above table

Ex. cid 1,2,8 will all have a cgid of say 13 .

If i want to get the value of $cgid in the foll code and then list out all cids with their addresses i cannot do it. Code:

View Replies !   View Related
Query Problem, JOINs And COUNT()s
So theres my short query. Per the mysql docs, mysql 4.0.4 and later can do joins in UPDATEs. Im on mysql 4.1.something so I'm good in that department. Problem is, when I run this, I get an error complaining about invalid use of group functions (#1111).

I don't understand why I need a group by, or how to figure out which I should use, but just for the hell of it, I tried GROUP BY rest.total and item.rid and every single other referenced table and table.field, and still nothing.

When I try to add a group by, it then complains about improper use of group by, or something like that. I don't see what I'm doing wrong here, seems like this little query should just work.

View Replies !   View Related
JOINs Vs Simple Multiple References
What is the advantage of using a join such as Code:

SELECT users.firstName, users.lastName, locations.city FROM users JOIN locations ON users.id=locations.user_id;

vs Code:

SELECT u.firstname, u.lastName, l.city FROM users u, locations l WHERE u.id=l.user_id

I find the latter far easier to read, however is there a major efficiency advantage to JOINS?

View Replies !   View Related
One More For The Nite Then Bed Time, Question On Joins
Not real sure on inner/outer/left and what ever else type of joins, still have some reading to do.

$result = mysql_query("SELECT a.ID, a.menu_id, a.submenu_title, a.display_order, b.menu_title, b.display_order FROM page_content as a JOIN menu as b ON (a.menu_id=b.ID) ORDER BY b.display_order,a.display_order",$db);

Any way here's my question, I have two fields in the tables that are named the same "display_order" and I cant figure out how to access both from this querry?

$var_menu_title = $MyRow['menu_title'];
$var_submenu_title = $MyRow['submenu_title'];
$var_menu_order = $MyRow['display_order'];

I am able to get menu_title from table b, submenu_title from table a, but display_order gives me display_order for table b(menu), I would have thought that would give me display_order for table a(page_content). how would I access both display_order fields from the different tables, I would like to list both.

View Replies !   View Related
Tips For Simplifying / Optimizing Multiple Joins
some of our queries use 6 joins. when i turn on slow query log, these queries regularly popup. i just wondered if anyone could give me some tips on simplifying and / or optimizing them....

View Replies !   View Related
Joins Tables Togeather To Get Thread Listings.
Ive written this join query, that joins tables togeather to get thread listings. PHP Code:

$sql = mysql_query("SELECT a.thread_id, a.starter_id, a.topic, a.time_created,
        a.time_replied, a.reply_id, a.sticky, a.locked, a.views, a.replys,
        b.active_id, c.username, c.class, c.age, c.gender, c.location, c.login_time
        FROM c_threads a
        LEFT JOIN c_active b ON a.starter_id = b.user_id
        LEFT JOIN c_users c ON a.starter_id = c.user_id
        WHERE a.forum_id = " . quote_smart($cat_id) . "
        ORDER BY a.announcement DESC, a.sticky DESC, a.time_created DESC"

View Replies !   View Related
PHP And MySQL: How To Properly Call A Stored Procedure With Output Parameters From PHP - Mysql, Mysqli, Or PDO
I am currently using PHP 5 and MySQL 5, both on Fedora Core 5. I am
unable to call a MySQL stored procedure that returns output parameters
using mysql, mysqli, or PDO. I'm having a hell of a time with it...

The following comes from phpinfo():
PHP Version: 5.1.2
mysql Client API version: 5.0.18
mysqli Client API version: 5.0.18
PDO Driver for MySQL, client library version: 5.0.18

MySQL version, from running SELECT version(); = 5.0.18

Here's the procedure I've created in MySQL:
CREATE PROCEDURE testproc(OUT p_testvar varchar(50)) BEGIN SET
p_testvar = 'HELLO WORLD!' END
[color=blue]
>From the MySQL Command Line, I can do the following:[/color]
mysql> call testproc(@a);
Query OK, 0 rows affected (0.00 sec)

mysql> select @a;
+--------------+
| @a |
+--------------+
| HELLO WORLD! |
+--------------+
1 row in set (0.00 sec)

View Replies !   View Related
Warning: Mysql_connect() [function.mysql-connect]: Lost Connection To MySQL Server
I've set up a test server on an Ubuntu system. I installed and configured Apache, PHP and MySQL however, whenever I try to connect to a MySQL database I get this error:
PHP Code:

Warning: mysql_connect() [function.mysql-connect]: Lost connection to MySQL server at 'reading initial communication packet', system error: 111 in /var/www/index.php on line 8
Lost connection to MySQL server at 'reading initial communication packet', system error: 111

Does anyone know what is causing this and how I can solve the problem?

View Replies !   View Related
Mysql_data_seek() [function.mysql-data-seek]: Offset 0 Is Invalid For MySQL Resu
mysql_data_seek() [function.mysql-data-seek]: Offset 0 is invalid for MySQL result index 8 (or the query data is unbuffered) in /home/realfina/public_html/ec/checkout/functions.php on line 457

And how do I fix it?

View Replies !   View Related
Create A Multi Table Database In MySQL And Write To And Retrieve Information Using MySQL.
I am trying to create a multi table database in MySQL and write to and retrieve information using MySQL. I am able to insert and call data easily enough going into one table, but I am having problems with connecting tables and using the idea of normalization.

I am starting simple with an online registration for alumni of an association. My first table in a database is called alumni and it stores there e-mail address, first and last name and year of graduation. Code:

View Replies !   View Related
MySQL Error - Supplied Argument Is Not A Valid MySQL-Link Resource
I am getting the error

Warning: mysql_select_db(): supplied argument is not a valid MySQL-Link resource in /home/server7/public_html/71/arranholloway/database4.php on line 7

I tested my code on local computer and there were no problems, the error message only appeared when I loaded it onto my web hosters server. I'm new to PHP so its probably something simple but any help would be appreciated.

View Replies !   View Related
Warning: Mysql_connect() [function.mysql-connect]: Unknown MySQL Server Host 'sql1bravehostcom'
Warning: mysql_connect() [function.mysql-connect]: Unknown MySQL server host 'sql1bravehostcom' (1) in /misc/13/000/126/295/2/user/web/jeppers90.com/includes/fiction_mysql.inc.php on line 11
Cannot connect to server

this message is what i get when i try to upload it to a webserver..things i have done set up database put in correct information from the database in to my php form. what ever i try i can't seem to set it up .

View Replies !   View Related
Connection With MySQL. Navicat - CANNOT CONNECT TO MYSQL SERVER ON LOCALHOST
I am new in PHP & MYSQL. I installed PHP & MYSQL properly. To easy
operate for MYSQL I installed Navicat and it installed properly. But
when I am going to test the connection between MYSQL & Navicate the
error message showing CANNOT CONNECT TO MYSQL SERVER ON LOCALHOST
(10022) it should mention that my connection name = localhost, Ip =
localhost,port = 3306 , user name = root in Navicat.


View Replies !   View Related
PHP Saying Error In Mysql Syntax, But Written My Mysql Query Browser!
I have a basic db that I access with MySQL query browser. Everything
seems fine to me but I am using this db as part of a php shopping
basket and when I try to add an item I get:

Notice: Query failed: You have an error in your SQL syntax; check the
manual that corresponds to your MySQL server version for the right
syntax to use near '>function.extract]: First argument should be an
array in functions.inc.php on line 31
Notice: Undefined variable: price in functions.inc.php on line 36
Notice: Undefined variable: price in functions.inc.php on line 39
Notice: Undefined variable: total in unctions.inc.php on line 39

I'm assuming the last three are caused by this problem as price should
be passed to the cart, and total is worked out using it. However
although I know mySQL code it was the MySQL query browser that
actually generated the code and I cannot see a way to view or debug
the code.

The db has one table in it which is made up of id, name, subname,
desc, and price.

The code in the php file that is being referred to is:

View Replies !   View Related
Can't Connect To Local MySQL Server Through Socket '/tmp/mysql.sock' (2)
this is a new error message I've not encountered before. looking at the phpinfo data, it says mysql.max_links is "unlimited" I'm using mysql_connect (vs pconnect). When I try inserting mysql_close() in my functions, I get the :

Can't connect to local MySQL server through socket '/tmp/mysql.sock' (2)

View Replies !   View Related
MySQL Pro Certified Server Versus MySQL Community Edition
Does anyone have any experience with this? I'm trying to see if the service provided with the "MySQL Network with MySQL Pro Certified Server" version is worth the costs involved.

I'm making a real estate website that's basically going to be a listing service. You can do searches on the listings for free, and it costs to add your listing. Our listings are only going to be active for 30 days, and we really don't expect to have more than maybe a thousand or so listings at a time tops.

I'm just wondering if this is something that should be manageable for me, even though I really don't have any prior DBA experience. I've played around with phpMyAdmin for a bit, so I know how to backup/replace/repair/etc., and am just wondering if this is enough. Any thoughts?

View Replies !   View Related
Warning: Mysql_connect(): Can't Connect To Local MySQL Server Through Socket '/tmp/mysql.sock' (2) In /home/custcare/dbconn.inc On Line 2
It's really strange. I downloaded the latest 4.0.16 RPM from mysql.com
and installed it to my Fedora system, and did *not* do anything else
(Actually I am completely new to mysql).

I wrote a test php script to test mysql (ftp_connect('localhost',
'root');), but got the following error:

Warning: mysql_connect(): Can't connect to local MySQL server through
socket '/tmp/mysql.sock' (2) in /home/custcare/dbconn.inc on line 2

I ran phpBB2 installation page, got the same error. But it can connect
to mysql using my computer name.

View Replies !   View Related
Automatic Scheduled MySQL Backup (MySQL Dump)
Is it possible to configure a UNIX/LINUX server to do a MySQL Dump for a database on an automatic schedule and then to email the dump file to me (the administrator)?

I want to be able to have my database automatically backed up every week and emailed to me for storage purposes without any action on my part.

View Replies !   View Related
PHP/MySQL: Using PHP To Probe MySQL Db And Send An Email Automatically
Let's say you have a login feature on your site... and a user forgets their password which is stored along side their email address in a MySQL database. Is it possible to use PHP to automatically send the password to that email address upon request? If so, please provide a detailed solution. If not, can Java be used in some way to accomplish this?

View Replies !   View Related
Mysql Connection - Connect To A Remote Mysql Database
I have problems getting my php webpage to connect to a remote mysql database. I can connect using the same name and password from the command prompt using mysql. I also have my own sql database on this computer that the php website can access.

View Replies !   View Related
--with-mysql ? Php-4.4.2 With Mysql Install In Special Directory
I'm trying to link php-4.4.2 with mysql install in special directory,
like /usr/newsystem/mysql, but whatever options I try, php always gets
linked to version in /usr/local/lib. I've tried several options:

--with-mysql=/usr/newsystem/mysql
--with-mysql-dir=/usr/newsystem/mysql
--with-mysql-lib=/usr/newsystem/mysql
--with-mysql-lib-dir=/usr/newsystem/mysql

....but none of them work, CLI is always build against /usr/local/lib/
libraries.

View Replies !   View Related
Create A Sequence In MySQL, With Mysql Variable?
This might be fairly easy to do and I think I've seen the code before,
but I haven't seen many good examples of this. Of course Pear::DB
probably uses this code in some of its API, probably in dealing with
auto-increment indexes and prepared statements.

Maybe I'm off base here, but I'm looking for something like this:
(psuedo-code)
Of course the seq table only needs 1 row holding id, which is
updated.
select id from tbl;
// get result resouce and do fetch, store value in $myid
set @myvar = $myid + 1; // can php send to MySQL with a query? (
never seen this )
update myseq set id=@myvar // send this statement through in a
update/query

// for use in PHP code
$newSeqVal = $myid +1

View Replies !   View Related
And Mysql - Connect Remotely To A Mysql Database.
I am trying to connect remotely to a mysql database.

here is the code:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_myDB = "http://db195.perfora.net";
$database_myDB = "dbname";
$username_myDB = "username";
$password_myDB = "password";
$myDB = mysql_pconnect($hostname_myDB, $username_myDB, $password_myDB)
or trigger_error(mysql_error(),E_USER_ERROR);
?>

here is the error:

Warning: mysql_pconnect(): Unknown MySQL Server Host 'db195.perfora.net'
(1) in /oldhome/WWW/wingsofthedawn.org/htdocs/final/Connections/myDB.php
on line 9

View Replies !   View Related
Copy And Paste On MySQL To MySQL Database
Would there be any issues if i literary Copy and Paste a mysql db from one server to another mysql db server? When i say "copy and paste" is just like tranferring one word doc from one pc to another pc.

I tried the copy and paste already and the new server had recognize the DB i had pasted. I just want to confirm if there would be issues doing it so.. Or should i use Mysql.com Migration toolkit?

View Replies !   View Related
Mysql Update - Grab The Value Count From Mysql
I'm trying to grab the value count from mysql and add one to it. This is very simple, but I"m still completely lost! here is the code:

require("connect.php");

$result = mysql_query("SELECT fav_count FROM favs WHERE page_id = $page");
$result++;
mysql_query("UPDATE favs SET fav_count = $result WHERE page_id = $page");

echo "Thank you for telling us you like this!<br />Please wait...";
echo "<META HTTP-EQUIV=Refresh CONTENT="2; URL=link.php">";
Any help is greatly appreciated!

View Replies !   View Related
Php/Mysql- Uploading Mysql Database
I've set up a basic database using Mysql (just creating a web blog I followed a tutorial) and then started writing the php code for interacting with the database. how do I put the Mysql database onto the the web server where I have server space (the server I use is just some company that I pay €100 a year for). I need the php file to get the data from the Mysql database...

View Replies !   View Related
Problem Getting PHP To Recognize MySQL, Using PHP 4.3.7 And MySQL 4.0.20
I have both PHP 4.0( RPM) installed and MySQL 4.0.20 installed with the
mysqld daemon up and running. But when I look at the output of phpinfo() ,
I do not see it there, which is worrisome and so I tried to recompile PHP
and do ./configure with the --with-mysql=path but I don't really know
where my mysql's header files should be , is there any way to find that
out by using any of the mysql commands?

I did try to do ./configure for PHP4 without any parameters and when I
looked at the output, I do see that PHP seems to recognize that mySQL is
there :

....
checking for MSSQL support via FreeTDS... no
checking for MySQL support... yes
checking for specified location of the MySQL UNIX socket... no
checking for MySQL UNIX socket location... /var/lib/mysql/mysql.sock
checking for inline... (cached) inline
.....

Hence, why is that when I do phpinfo() , mySQL still doesn't show up?

I suspect that mysql isn't working correctly with php, because if I use
the mysql_connect() function in my php, I get the error "Fatal error: Call
to undefined function: mysql_connect() "
and yet it DOES seem like PHP recognizes mysql is there.

That "unable to recognize mysql_connect function" error comes up after
installing PHP using ./configure with or without any parameters.

View Replies !   View Related
Seeking Resources On Mysql, Not Mysql.com
I'm looking for some resources that can aid me in getting deeper into
php/mysql.
I am presently looking at a syntax that lets me check a mysql row for one
particular value, using sql.
Then I look for a sql based solution to get a column name based on the above
value.
Last I need to update that row, actually NULL that particular field in that
particular row.

I've been reading mysql.com the function list all afternoon, nothing found
that might make it able for me to write those statements in question.
So now I better expand and seek new sources, google.com didn't give me much
while searching the groups.

View Replies !   View Related
Migrate Old Mysql DB To New Mysql Server
I am trying to migrate our old mysql DB to another new mysql server using AB: MySQL Migration Tool. The migration has some problem.

One of the tables from the old DB had a column defined Datatype as DATE. However, when I do migration. The migration informs me that " The following error occured while transfering data from log Cannot convert value '0000-00-00' from column 13 to TIMESTAMP."

I believe the migration forces to convert the datatype into timestamp. The work around i can do on this is to change the datatype of the column on the old DB into Timestamp. However, I don't want that. I want to retain the DATE datatype.

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved