barney0o0 Posted May 21, 2008 Share Posted May 21, 2008 Hi Folks, as some of you may have agathered im a bit a newb... Im trying to create values from a db that i can reference later in the script. Unfortunatley i use a combintaion of hand and dreamweaver, so please dont shoot me down.. There will only be one record available in the db. what im using after the connection is; <?php $date = @mysql_query('SELECT dateid FROM flyerdate'); if (!$date) { exit('<p>Unable to get date</p>'); } $feature = @mysql_query('SELECT featureid FROM flyerdate'); if (!$feature) { exit('<p>Unable to get feature</p>'); } $laban = @mysql_query('SELECT labanid FROM flyerdate'); if (!$laban) { exit('<p>Unable to get laban</p>'); } ?> then later i try and cross reference thi svalue in the select statement mysql_select_db($database_*, $*); $query_Recordset1 = "SELECT * FROM events WHERE events.id = '".$feature."'"; $Recordset1 = mysql_query($query_Recordset1, $*) or die(mysql_error()); $row_Recordset1 = mysql_fetch_assoc($Recordset1); $totalRows_Recordset1 = mysql_num_rows($Recordset1); i dont get any errors, however i dont get any results.... ny ideas?..thanks in advance Link to comment https://forums.phpfreaks.com/topic/106588-simple-retrieving-values-from-select/ Share on other sites More sharing options...
phpzone Posted May 21, 2008 Share Posted May 21, 2008 What gives with the $*'s mysql_select_db($database_*, $*); and $Recordset1 = mysql_query($query_Recordset1, $*) or die(mysql_error()); are you just blanking things out here you don't want people to see? are you sure that mysql_select_db is working, add a die(). Is $feature the correct variable, what if you var_dump the SQL command, does it look right? Link to comment https://forums.phpfreaks.com/topic/106588-simple-retrieving-values-from-select/#findComment-546344 Share on other sites More sharing options...
barney0o0 Posted May 21, 2008 Author Share Posted May 21, 2008 Cheers With the initial connection im using; <?php $dbcnx = @mysql_connect('*', '*', '*'); if (!$dbcnx) { exit('<p>Unable to connect to the ' . 'database server at this time.</p>'); } $db_selected = mysql_select_db("*", $dbcnx); if (!$db_selected) { die ("Can\'t use test_db : " . mysql_error()); }?> the other $'s are just removed for safety ive tried the var_dump using <?php $feature = @mysql_query('SELECT featureid FROM flyerdate'); var_dump($feature); ?> and i get 'resource(3) of type (mysql result)' (which i dont really undertsand!) Link to comment https://forums.phpfreaks.com/topic/106588-simple-retrieving-values-from-select/#findComment-546352 Share on other sites More sharing options...
barney0o0 Posted May 21, 2008 Author Share Posted May 21, 2008 any thoughts? Link to comment https://forums.phpfreaks.com/topic/106588-simple-retrieving-values-from-select/#findComment-546494 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.