Re: [PHP-DB] MYSQL Query problem...

2003-09-21 Thread John W. Holmes
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


Re: [PHP-DB] MYSQL Query problem...

2003-09-21 Thread Fedde van Feggelen

is there something wrong with my SQL Query? I didnt get any results 
neither errors..


$link = mysql_connect('localhost', '') 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


[PHP-DB] MYSQL Query problem...

2003-09-21 Thread Ian Bert Tusil
is there something wrong with my SQL Query? I didnt get any results neither errors..

') 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


[PHP-DB] MySQL Query problem...

2002-07-08 Thread NIPP, SCOTT V (SBCSI)

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

2001-07-26 Thread Paul Burney

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.

';
 
$sql="SELECT * FROM contacts WHERE ContactID='$ContactID'";

echo 'SQL query is: ' , $sql, '';

$result = mysql_query($sql,$db);

printf("%s\n", mysql_result($result,"FirstName"));

printf("%s\n", mysql_result($result,"LastName"));

?>

Hope that helps.

Sincerely,

Paul Burney

+-+-+
| Paul Burney | P: 310.825.8365 |
| Webmaster && Programmer | E: <[EMAIL PROTECTED]>   |
| UCLA -> GSE&IS -> ETU   | W:  |
+-+-+


-- 
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]




Re: [PHP-DB] mysql query problem

2001-07-26 Thread Steve Fitzgerald

ContactID is setup as a tinyint so I dropped the single ticks. No luck. I
ran the query in the MySQL client and got the ERROR 1054: Unknown column
'$ContactID' in 'where clause'.  I know the column ContactID exists.

Steve


"Josh Hoover" <[EMAIL PROTECTED]> wrote in message
E973048AB322D411AE99009027E32DF685CCF3@FRAZ">news:E973048AB322D411AE99009027E32DF685CCF3@FRAZ...
> In your query, do you need the single ticks around the $ContactID?  Is the
> ContactID column a char/varchar field which would require the single
ticks?
> I'm wondering if that's causing your problem.  Also, what if you do that
> query via the MySQL client?  What do you get then?
>
> Josh Hoover
> KnowledgeStorm, Inc.
> [EMAIL PROTECTED]
>
> Searching for a new IT solution for your company? Need to improve your
> product marketing?
> Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can
simplify
> the process for you.
> KnowledgeStorm - Your IT Search Starts Here
>
> > I'm trying to query my database to fill in data First Name
> > Last Name. Using
> > the script below I get (depending on the ContactID I enter)
> >
> > Contact: 1 1 or 2 2
> >
> > If ContactID=0 I get
> >
> > Contact:
> >
> > Any ideas on what I am doing wrong?
> >
> > Thanks.
> >
> > Steve Fitzgerald
> >
> >  > $sql="SELECT * FROM contacts WHERE ContactID='$ContactID'";
> >   $result = mysql_query($sql,$db);
> >
> >printf("%s\n", mysql_result($result,"FirstName"));
> >
> > printf("%s\n", mysql_result($result,"LastName"));
> >
> >
> >   ?>
>



-- 
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]




RE: [PHP-DB] mysql query problem

2001-07-26 Thread Hoover, Josh

In your query, do you need the single ticks around the $ContactID?  Is the
ContactID column a char/varchar field which would require the single ticks?
I'm wondering if that's causing your problem.  Also, what if you do that
query via the MySQL client?  What do you get then?

Josh Hoover
KnowledgeStorm, Inc.
[EMAIL PROTECTED]

Searching for a new IT solution for your company? Need to improve your
product marketing? 
Visit KnowledgeStorm at www.knowledgestorm.com to learn how we can simplify
the process for you.
KnowledgeStorm - Your IT Search Starts Here 
 
> I'm trying to query my database to fill in data First Name 
> Last Name. Using
> the script below I get (depending on the ContactID I enter)
> 
> Contact: 1 1 or 2 2
> 
> If ContactID=0 I get
> 
> Contact:
> 
> Any ideas on what I am doing wrong?
> 
> Thanks.
> 
> Steve Fitzgerald
> 
>  $sql="SELECT * FROM contacts WHERE ContactID='$ContactID'";
>   $result = mysql_query($sql,$db);
> 
>printf("%s\n", mysql_result($result,"FirstName"));
> 
> printf("%s\n", mysql_result($result,"LastName"));
> 
> 
>   ?>



[PHP-DB] mysql query problem

2001-07-26 Thread Steve Fitzgerald

I'm trying to query my database to fill in data First Name Last Name. Using
the script below I get (depending on the ContactID I enter)

Contact: 1 1 or 2 2

If ContactID=0 I get

Contact:

Any ideas on what I am doing wrong?

Thanks.

Steve Fitzgerald

\n", mysql_result($result,"LastName"));


  ?>



-- 
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]