stmosaic Posted June 22, 2007 Share Posted June 22, 2007 This is weird and I'm at my wits end trying to see what is wrong with my code. Need another set of eyes to double check me. 4 days ago this code worked. Today to my horror, it didn't. Can anyone see what is wrong with my code? PHP Designer shows NO syntax errors. I appreciate any help you can offer. <?php $DBASE="dbname"; $DBTABLE="table"; $DBASEUSER="UN"; $DBASEPASSWORD="PW"; //DB CONNECTION// $dbcnx = @mysql_connect("localhost", "$DBASEUSER", "$DBASEPASSWORD"); if (!$dbcnx) { echo( "<p>Unable to connect to the " . "database server at this time.</p>" ); exit(); } if (! @mysql_select_db("$DBASE") ) { echo( "<p>Unable to locate the " . "database at this time.</p>" ); exit(); } $SelectedState=$_REQUEST['SelectedState']; //testing variable passing// echo "$SelectedState"; ///////This testing WORKS//////// ///Doesn't seem to work beyond here//// if ($SelectedState == "ALL") { $result = mysql_query("SELECT * FROM $DBTABLE WHERE Approved='Y' ORDER BY State, City, Name ASC"); }else{ $result = mysql_query("SELECT * FROM $DBTABLE WHERE State='$SelectedState' AND Approved='Y' ORDER BY City, Name ASC"); } if (!$result) { echo("<p>Error performing query: " . mysql_error() . "</p>"); if(mysql_num_rows($result) == 0) { echo("There are no members in $SelectedState."); } exit(); } //abreviated this section of variables to save space on forum// while ( $row = mysql_fetch_array($result)) { $IDENT=$row["ID"]; $NAME=$row['Name']; $COMPANY=$row['Company']; $ADDRESS=$row['Address']; $ADDRESS1=$row['Address1']; $CITY=$row['City']; $STATE=$row['State']; $ZIP=$row['Zip']; $MEMBERTYPE=$row['MemberType']; $MARKETCITY1=$row['MarketCity1']; $MARKETCITY2=$row['MarketCity2']; $MARKETCITY3=$row['MarketCity3']; $MARKETCITY4=$row['MarketCity4']; $WEBSITEURL=$row['WebsiteURL']; //===DISPLAY ALL LISTINGS===// echo("<table width=\"100%\" border=0><tr><td width=\"50%\" valign=\"top\"><font face=\"Arial, Helvetica, sans-serif\" size=2><b>$NAME</b></font></td><td>"); if ($COMPANY != ""){echo ("<font face=\"Arial, Helvetica, sans-serif\" size=2><b>$COMPANY</b></font>");} echo ("</td></tr><tr><td width=\"50%\" valign=\"top\"><font face=\"Arial, Helvetica, sans-serif\" size=2>$ADDRESS<br>"); if ($ADDRESS1 != ""){echo ("$ADDRESS1<br>");} echo ("$CITY, $STATE, $ZIP<br>$MEMBERTYPE $MEMBERSHIPTYPE"); if (($AGENTSNUMBER != "") OR ($AGENTSNUMBER != 0)) {echo (": $AGENTSNUMBER Agents");} echo ("<br>$MARKETCITY1"); if ($MARKETCITY2 != ""){ echo(", $MARKETCITY2"); } if ($MARKETCITY3 != ""){ echo(", $MARKETCITY3"); } if ($MARKETCITY4 != ""){ echo(", $MARKETCITY4"); } echo ("</font></td> <td colspan=2 valign=\"top\"><font face=\"Arial, Helvetica, sans-serif\" size=2><br>$PHONE<br> Fax: $FAX<br> $EMAIL<br> $WEBSITEURL<br> </font></td> </tr> </table><br> "); } mysql_close($dbcnx); ?> Quote Link to comment Share on other sites More sharing options...
Caesar Posted June 22, 2007 Share Posted June 22, 2007 What errors are being returned?...And are you suppressing errors? Quote Link to comment Share on other sites More sharing options...
stmosaic Posted June 22, 2007 Author Share Posted June 22, 2007 That's what's so annoying, no errors are being returned. As far as I know, I'm not suppressing the errors. What I posted is the complete code with just some variables in the while shortened. Quote Link to comment Share on other sites More sharing options...
L Posted June 22, 2007 Share Posted June 22, 2007 that's interesting because the same thing is happening to me and my script...it was working fine but then it just died on me....i still don't have a solution though because i too posted a thread about posting comments yesterday Quote Link to comment Share on other sites More sharing options...
stmosaic Posted June 22, 2007 Author Share Posted June 22, 2007 Hey L, your situation is making me wonder, who is your server hosting company? Mine is Interland (aka Peer1) Quote Link to comment Share on other sites More sharing options...
L Posted June 22, 2007 Share Posted June 22, 2007 Well I don't have paid hosting, but I use prohosts and phpnet. Quote Link to comment Share on other sites More sharing options...
teng84 Posted June 22, 2007 Share Posted June 22, 2007 can you tell us your expected output with that code and what does that code give you??? Quote Link to comment Share on other sites More sharing options...
stmosaic Posted June 25, 2007 Author Share Posted June 25, 2007 Expected output is the data from the database. If the passed parameter is "ALL", then it is to show all entries in the DB. If a state is selected, for example, NC. Then only those listings for NC show up. The code is giving me nothing but a blank where the output should be. I've tested the passing of the variable & that works. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.