Philip Olson wrote:
> Are you sure this is the correct file?  This is full 
> of syntax errors, you should be getting parse errors.
> 
> A few tips:
> 
>  a) Don't post to multiple lists.  This is a PHP issue, 
>     not MySQL.  Hopefully this will end the mysql list
>     thread.
> 
>  b) Don't use mysql_db_query() as it is deprecated.  See:
>       http://www.php.net/mysql_db_query
>     Use mysql_select_db() and mysql_query() instead.
> 
>  c) Be 100% this is right file, or if this (what you gave 
>     us) is the exact code in that file.  I doubt it is.
> 
>  d) If an error is on line 12, tell us what line #11-13 are.
> 
>  e) While developing, put error_reporting(E_ALL); on top 
>     of your script.
> 
>  f) Don't fully rely on syntax highlighting of your text 
>     editor as it will never be perfect.
> 
> To narrow down the error, try this format:
> 
> <?php
> 
>   if (!$conn = mysql_connect($host, $username, $password)) {
>     print "Could not connect: " . mysql_error();
>     exit;
>   }
> 
>   if (!mysql_select_db($dbname)) {
>     print "Could not select DB " . mysql_error();
>     exit;
>   }
> 
>   $sql = "Your SQL goes here";
>   
>   if (!$result = mysql_query($sql)) {
>     print "Could not run query ($sql) : " . mysql_error();
>     exit;
>   }
> 
>   print "Thank you for submitting the data, we got it";
> 
> ?>
> 
> Basically, we are checking if these functions return 
> false.  If they do, an error will be sent and the 
> script will exit.  Instead of using exit each time, 
> you may want to implement your own db error management 
> so if a db error occurs you load a static page or 
> your webmaster email or whatever.  But the above should 
> narrow down your error and is a good start.
> 
> The original reason you got this error is, I assume, that 
> you treated $link_glob as a simple string.  Other replies 
> discussed this a bit.  Lastly:
> 
>   print $foo;   // sexy
>   print "$foo"; // not as sexy but will work (eww)
>   print '$foo'; // literally prints a string $foo and 
>                 // not the value of $foo.  bad.
> 
> Read/study this tutorial on using strings:
>   http://www.zend.com/zend/tut/using-strings.php
> 
> Good luck, you'll get the hang of it soon :)
> 
> Regards,
> Philip Olson
> 
> 
> On Mon, 3 Jun 2002, Jule Slootbeek wrote:
> 
> 
>>Jule Slootbeek wrote:
>>
>>>G r e g L a w r i e wrote:
>>>
>>>
>>>>It would also appear you are missing a closing ) at the end of the
>>>>'$query=...' line. You have two opening backets and only one closing.
>>>>
>>>>Greg
>>>>
>>>>-----Original Message-----
>>>>From: Bruce Lewis [mailto:[EMAIL PROTECTED]]
>>>>Sent: Tuesday, 4 June 2002 7:50
>>>>To: [EMAIL PROTECTED]; mysql; php-general
>>>>Subject: Re: stupid error, please kick me (and send me a solution)
>>>>
>>>>
>>>>Your missing your closing "}" at the end of the else statement.
>>>>
>>>>
>>>>----- Original Message -----
>>>>From: "Jule Slootbeek" <[EMAIL PROTECTED]>
>>>>To: "mysql" <[EMAIL PROTECTED]>; "php-general"
>>>><[EMAIL PROTECTED]>
>>>>Sent: Monday, June 03, 2002 5:09 PM
>>>>Subject: stupid error, please kick me (and send me a solution)
>>>>
>>>>
>>>>
>>>>
>>>>>Hey guys,
>>>>>i'm getting this error with the following sql script using php:
>>>>>--error--
>>>>>Warning: Supplied argument is not a valid MySQL-Link resource in
>>>>>/var/www/phpquiz/register_user.php on line 12
>>>>>--error--
>>>>>
>>>>>--script--
>>>>>$link_glob = "mysql_connect('$host_glob', '$un_glob', '$pw_glob')";
>>>>>$query = "INSERT INTO user values('0', '$fname', '$lname', '$email',
>>>>>'$username', PASSWORD('$password')";
>>>>>$result = mysql_db_query('$db_glob', '$query', $link_glob');
>>>>>if (!$result) {
>>>>>echo "<font size=+1>Your Information could not be entered into the
>>>>
>>>>
>>>>database,
>>>>
>>>>
>>>>>Please contact the <a
>>>>>href=mailto:$webmaster>webmaster</a>.</font><br><br>" . mysql_errno() .
>>>>>": " . mysql_error() . "<br><br>";
>>>>>} else {
>>>>>echo "<font size=+1>Your Information has successfully been entered into
>>>>
>>>>
>>>>the
>>>>
>>>>
>>>>>database!</font><br>";
>>>>>
>>>>>-- 
>>>>>Jule Slootbeek
>>>>>[EMAIL PROTECTED]
>>>>>
>>>>>http://blindtheory.cjb.net
>>>>>
>>>>>
>>>>>
>>>>>---------------------------------------------------------------------
>>>>>Before posting, please check:
>>>>>  http://www.mysql.com/manual.php   (the manual)
>>>>>  http://lists.mysql.com/           (the list archive)
>>>>>
>>>>>To request this thread, e-mail <[EMAIL PROTECTED]>
>>>>>To unsubscribe, e-mail
>>>>
>>>>
>>>><[EMAIL PROTECTED]>
>>>>
>>>>>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>>---------------------------------------------------------------------
>>>>Before posting, please check:
>>>>   http://www.mysql.com/manual.php   (the manual)
>>>>   http://lists.mysql.com/           (the list archive)
>>>>
>>>>To request this thread, e-mail <[EMAIL PROTECTED]>
>>>>To unsubscribe, e-mail
>>>><[EMAIL PROTECTED]>
>>>>Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
>>>>
>>>
>>>$query = "INSERT INTO user values('0', '$fname', '$lname', '$email', 
>>>'$username', PASSWORD('$password')";
>>>
>>>that should be all closed shouldn't it?
>>>my text editor colors code, and it doesn't show any mistakes..
>>>thanks though
>>>Jule
>>>
>>
>>well it didn't fix it, but still thanks,
>>
>>Jule
>>
>>
>>
>>-- 
>>Jule Slootbeek        
>>[EMAIL PROTECTED] 
>>
>>http://blindtheory.cjb.net 
>>      
>>
>>
>>-- 
>>PHP General Mailing List (http://www.php.net/)
>>To unsubscribe, visit: http://www.php.net/unsub.php
>>
> 
> 
OK thanks a lot for all the info, i'll go through and put some more 
checks in...thanks!!
really appreciate it..
Jule

ps (what does the error_reporting(E_ALL); exactly do?)




-- 
Jule Slootbeek  
[EMAIL PROTECTED] 

http://blindtheory.cjb.net 
        


---------------------------------------------------------------------
Before posting, please check:
   http://www.mysql.com/manual.php   (the manual)
   http://lists.mysql.com/           (the list archive)

To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php

Reply via email to