You are here: Re: Assign mysql record values to gloabl variabel « PHP Programming Language « IT news, forums, messages
Re: Assign mysql record values to gloabl variabel

Posted by Mel on 07/11/06 13:53

On 2006-07-11 23:47:26 +1000, "Julian Moorhouse" <mindwarpltd@gmail.com> said:

> Hi,
>
> I've been struggle with the code below.
> I've tried mysql_fetch_assoc and various other functions, but can't
> seem to get it to work.
> The code works as far as that point though.
>
> Any suggestions?
>
> Jules.
>
> global $first_name;
> global $last_name;
> global $password;
>
> function get_acct_rec($email){
>
> $conn = db_connect(HOST, USER, PASS, DB, PORT);
>
> $sql = "SELECT * FROM `clients` WHERE `email` = '" . $email . "';";
>
> $c_result = mysql_query($sql, $conn) or die("Failed to execute query
> at line " . __LINE__ . ": " . db_error($conn));
>
>
> while ($row = mysql_fetch_assoc($c_result)) {
> $first_name = $row['first_name'];
> $last_name = $row['last_name'];
> $password = $row['password'];
> echo $row['first_name'];
> }
>
> mysql_free_result($result);
>
> db_close($conn);
>
> }

Have you tried dumping out the SQL statement and running the SQL
directly on the database server? If that's okay, var_dump the $conn
variable to make sure it's a valid connection object. If it is, try
var_dump'ing the $row variable from inside the loop to see what it's
being populated with. Sorry if these suggestions seem a little obvious.

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация