[PHP-DB] MYSQL Query problem...
is there something wrong with my SQL Query? I didnt get any results neither errors.. ?php $link = mysql_connect('localhost', 'username') or die('Cannot connect to the database.'); mysql_select_db(profiles,$link); $SQLQuery = INSERT INTO profyles (username, fname, mname, lname, address, country, gender, sexuality, status, bday, race, yahoo, msn, icq, email, webpage, hair, bodytype, eye, height, weight, facialhair, hobbies, interests, aboutme, profession, food, music, tvshows, authors, movies, rolemodel, place, visit, online, picture) VALUES ('$user', '$firstname', '$middlename', '$lastname ', '$address, '$country', '$gender', '$sexuality', '$status', '$birthday', '$race', '$yahoo', '$msn', '$icq', '$email'. '$webpage', 'haircolour', '$bodytype', '$eyecolour', '$height', '$weight', '$facialhair', '$hobbies', '$interest', '$aboutme', '$profession', '$food', '$music', '$tvshows', '$authors', '$movies', '$rolemodel', '$place', 0, 'y' , 'y'); mysql_query($SQLQuery,$link); ? ian
Re: [PHP-DB] MYSQL Query problem...
is there something wrong with my SQL Query? I didnt get any results neither errors.. ?php $link = mysql_connect('localhost', 'username') or die('Cannot connect to the database.'); mysql_select_db(profiles,$link); $SQLQuery = INSERT INTO profyles (username, fname, mname, lname, address, country, gender, sexuality, status, bday, race, yahoo, msn, icq, email, webpage, hair, bodytype, eye, height, weight, facialhair, hobbies, interests, aboutme, profession, food, music, tvshows, authors, movies, rolemodel, place, visit, online, picture) VALUES ('$user', '$firstname', '$middlename', '$lastname ', '$address, '$country', '$gender', '$sexuality', '$status', '$birthday', '$race', '$yahoo', '$msn', '$icq', '$email'. '$webpage', 'haircolour', '$bodytype', '$eyecolour', '$height', '$weight', '$facialhair', '$hobbies', '$interest', '$aboutme', '$profession', '$food', '$music', '$tvshows', '$authors', '$movies', '$rolemodel', '$place', 0, 'y' , 'y'); mysql_query($SQLQuery,$link); ? '$email'. '$webpage' -- shouldn't this be:'$email', (comma ;))'$webpage' laters, Fedde ~= Everybody lies, but it doesn't matter because nobody listens =~ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] MYSQL Query problem...
Ian Bert Tusil wrote: is there something wrong with my SQL Query? I didnt get any results neither errors.. [snip] mysql_query($SQLQuery,$link); That's because you're not checking for errors... mysql_query($SQLQuery,$link) or die(mysql_error()); -- ---John Holmes... Amazon Wishlist: www.amazon.com/o/registry/3BEXC84AB3A5E/ php|architect: The Magazine for PHP Professionals www.phparch.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] MySQL Query problem...
I seem to have run into another problem with a query that I am doing exactly like the example in the MySQL documentation, I think. The following query is not working on my PHP page, and it is not working from a MySQL command line either. This looks exactly the same as an example in the MySQL documentation though. Thanks in advance for the help again. SELECT * FROM oncall WHERE TO_DAYS(NOW()) - TO_DAYS(ptime) = 3 This is the query that I am ultimately after: SELECT * FROM oncall ORDER BY 'ptime' ASC WHERE TO_DAYS(NOW()) - TO_DAYS(ptime) = 3 I am trying to display all of the records from the past three days. This looks like the way to go about doing this, but if there is a better way please let me know. (Just as more info, the 'ptime' field is a datetime type of field.) Scott Nipp Phone: (214) 858-1289 E-mail: [EMAIL PROTECTED] Web: http:\\ldsa.sbcld.sbc.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] mysql query problem
on 7/26/01 11:11 AM, Steve Fitzgerald ([EMAIL PROTECTED]) wrote: ran the query in the MySQL client and got the ERROR 1054: Unknown column '$ContactID' in 'where clause'. I know the column ContactID exists. Of course it did. It can't find the text $ContactID in the table. Try putting in a number (1,2,3, etc.) and see if it works. If it does, try echo'ing out the $ContactID and the $sql to the screen. See if $ContactID really is set and then try the output of $sql in the MySQL client. ?php echo 'ContactID is: ' , $ContactID, 'br'; $sql=SELECT * FROM contacts WHERE ContactID='$ContactID'; echo 'SQL query is: ' , $sql, 'br'; $result = mysql_query($sql,$db); printf(%s\n, mysql_result($result,FirstName)); printf(%sbr\n, mysql_result($result,LastName)); ? Hope that helps. Sincerely, Paul Burney +-+-+ | Paul Burney | P: 310.825.8365 | | Webmaster Programmer | E: [EMAIL PROTECTED] | | UCLA - GSEIS - ETU | W: http://www.gseis.ucla.edu/ | +-+-+ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]