Gossamer Forum
Home : General : Internet Technologies :

Getting results, but not passing back values?

Quote Reply
Getting results, but not passing back values?
Hi. I'm using the following script;

Code:
// connect to mySQL and if not pass back an error
$connection = mysql_connect($host, $username, $password); $error = mysql_error();
if (!$connection) { error("Unable to connect with your login info for MySQL. Reason: $error", $connection); }
if ($debug) { echo "host connection established...."; } //a little something for debugging

// now we need to connect the database
$db = mysql_select_db($database, $connection); $error = mysql_error();
if (!$db) { error("Unable to execute command. Reason: $error", $connection); }
if ($debug) { echo "database connection established....<BR>"; } // a little debugging info if needed...


// get the links details...
$query = "SELECT ID FROM lsql_Links WHERE Title = '" . $sliced[1] . "' AND Contact_Name = '" . $sliced[6] . "' AND Contact_Email = '" . $sliced[7] . "'";
if ($debug) { echo $query . "<BR>"; }

$banner = mysql_query($query);
$error = mysql_error();
if (!$banner) { error("Unable to execute query to mySQL Database to get URL. Reason: $error. <BR><BR>Query was: $query", $connection); }
if ($debug) { echo "query executed....<BR>"; }

//get info we need...
while ($hit = mysql_fetch_array($banner)) {

echo $sliced[0] . "::" . $hit->{'ID'} . "<BR>";

}

the problem is, it returns the correct number of SQL results, but just won't pass the variables back (FYI, $sliced[] is defined earlier). It just prints stuff like;

2::
4::
7::
43::
54::
76::

Anyone got any ideas where I am going wrong? Unsure

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
Quote Reply
Re: [Andy] Getting results, but not passing back values? In reply to
It looks like you're using perl/object syntax to reference the array $hit.

Shouldn't it be $hit['ID'] instead?

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] Getting results, but not passing back values? In reply to
Wink ...the joys of php vs perl
Quote Reply
Re: [Paul] Getting results, but not passing back values? In reply to
...or the perils of trying to code regularly in both! Tongue

Fractured Atlas :: Liberate the Artist
Services: Healthcare, Fiscal Sponsorship, Marketing, Education, The Emerging Artists Fund
Quote Reply
Re: [hennagaijin] Getting results, but not passing back values? In reply to
In Reply To:
It looks like you're using perl/object syntax to reference the array $hit.

Shouldn't it be $hit['ID'] instead?

OMG...you're right! That will serve me right for doing work on my LinksSQL Plugins just before trying to get that code to work Frown

>>>...or the perils of trying to code regularly in both! <<<

Too right Pirate

Cheers

Andy (mod)
andy@ultranerds.co.uk


IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates