PHP - Using Variable In Mysql_query Where Statement Not Working
I've been baffled by this for 2 days now and cannot figure it out after exhaustive searches. I'd like to think I'm doing this correctly, but cannot get it to work.
I'm trying to use a variable within a query WHERE statement, and it shows 0 results. If I directly hardcode the text instead of using the variable, it works. The variable is pulling from a $_GET, and if I echo that variable, it is showing the correct text.
Here's my code:
$Domain = $_GET['Domain']; $result = mysql_query(SELECT Code, Title, Domain, Status FROM tablename WHERE Domain="$Domain" ORDER BY Code');If I swap out "$Domain" for direct text, like "ABC", it works. I have tried swapping out the quotes and single quotes throughout the statement, removing the quotes around $Domain, concatenating the statement separately....all yield erros or the same result. And as stated, if I echo $Domain, it shows "ABC" (or whatever it's supposed to show), so i know it's pulling correctly from the $_GET. Anyone know what I'm doing wrong? Similar TutorialsI'm having issues with the following: Code: [Select] <?php session_start(); $_SESSION['username']=$_POST['username']; $_SESSION['password']=$_POST['password']; if($_SESSION['username']=="username" && $_SESSION['password']=="password"){ if($_GET['product']=="add"){ $content.=' <p><label>Product Name:</label> <input type="text" name="product_name" size="30" /> <label>Product Price:</label> <input type="text" name="product_price" size="5" /> </p> <p><label>Product Category:</label> <input type="text" name="product_category" size="30" /></p> <p><label>Product Link:</label> <input type="text" name="product_link" size="30" /></p> <p><label>Product Image:</label> <input type="text" name="product_image" size="30" /></p> <p><label>Product Tag:</label> <input type="text" name="product_tag" size="30" /></p> <p><label>Product Keywords:</label> <input type="text" name="keyword" size="30" /></p> <p><label>Product Features:</label><br /> <textarea name="product_features" rows="10" cols="60"></textarea> </p> <p><label>Product Pros:</label><br /> <textarea name="product_pros" rows="5" cols="30"></textarea> </p> <p><label>Product Cons:</label><br /> <textarea name="product_cons" rows="5" cols="30"></textarea> </p> <p><label>Product Description:</label><br /> <textarea name="product_description" rows="10" cols="60"></textarea> </p> <p><label>Product Notes:</label><br /> <textarea name="product_notes" rows="5" cols="30"></textarea> </p> '; $logout='<div><a href="./acp_admincp.php?log-out">Log-Out</a></div>'; } elseif($_GET['product']=="view"){ } else{ $content.=' <a href="./admincp.php?product=add">Add New Product</a> <br /> <a href="./admincp.php?product=view">View Products</a> '; } } elseif(isset($_GET['log-out'])){ session_start(); session_unset(); session_destroy(); header("Location: ./admincp.php"); } else{ $content=' <form action="./admincp.php" method="post"> <p><label>Username:</label> <input type="text" name="username" size="30" />'; $content.='</p> <p><label>Password:</label> <input type="password" name="password" /></p>'; $content.='<p><input type="submit" value="Submit" name="Submit" /></p> </form>'; } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <base href="http://ghosthuntersportal.com/" /> <title>Ghost Hunter's Portal - Admin Control Panel</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="verify-v1" content="" /> <meta name="keywords" content="ghost, hunters, hunter, ghosts, spirit, spirits, paranormal, investigation, investigator, investigators, k2, emf, meter, kii" /> <meta name="description" content="Ghost Hunters Potal. Parnormal research equipment store." /> <meta name="author" content="Andrew McCarrick" /> <meta name="robots" content="index, follow" <link rel="stylesheet" type="text/css" href="style.css" /> </head> <body> <img src="./logo.png" alt="Ghost Hunter's Portal Admin Control Panel" /> <br /> <div style="color: #AA44AA; font-size: 26px; margin-top: -30px; margin-left: 125px;">Admin Control Panel</div> <?php echo $logout; echo $content; ?> </body> </html> I can log-in, and get to the page with the two links on it. However, once I click one of the links it falls back to the log-in page, and it ends up being a never ending loop. It's doing this: Log-In --> Page with links ---> Log-In page again Should be doing this: Log-In --> Page with links --> Add Product page or View Products page I can never get into the the actual sub page. Just to be clear, the address bar actually shows product=add or product=view, but it still shows the log-in page. Hi guys, I have an interesting situation and I was hoping someone could explain what is going on to me. I have an enquiry form on a site that sends an e-mail. All the code is on one page with the form submitting back to the same page. I have a variable, msg, which at the top of the page is set to nothing and then an if statement to see if the form was submitted. If the form was submitted then msg will have one of three messages in it by the end (regardless of anything else). However when I check the msg variable after the if statement it is empty. To test if it was being affected I changed the initial value from nothing to TEST. After the IF statement the variable still held the value TEST, thus confirming it wasn't being affected by the IF statement. Now onto my code (the whole page is over 600 lines long so I'm only posting the relevant code): Code: [Select] <?php session_start(); $msg = ''; $input = array( 24 variables from form here... ); if(isset($_POST['form-submitted'])) { $missing_info = FALSE; $array = array( variables along with their filter validation/sanitize types... ); $input = filter_input_array(INPUT_POST, $array); /* PHP validation code checking appropriate fields were not empty. If they were set $missing_info = TRUE */ if(!$missing_info) { /* Construct e-mail, this sends successfully. */ if(mail($to, $subject, $content, $headers)) { $msg = '<div class="message"><h1>Form Sent</h1><br />Your form has been sent to us. We endevour to respond to all booking requests with 2 working days. If you have not heard from us in that time please contact us on 01462 893620. If you chose to confirm by post please allow 5 working days before contacting us.</div>'; $_SESSION['msg'] = $msg; } else { $msg = '<div class="message"><h1>Technical Issues</h1><br />We appologise but the website is currently experiencing technical difficulties. Please try again later or print this form out and post / fax it to us. Alternatively you can call us on 01462 893620.</div>'; $_SESSION['msg'] = $msg; } } else { $msg = '<div class="message"><h1>Incomplete Form<h1><br />Please make sure to complete all fields of the form before submitting your booking request.</div>'; $_SESSION['msg'] = $msg; } } if(isset($_SESSION['msg'])) { $msg = $_SESSION['msg']; unset($_SESSION['msg']); } ?> If I don't load the message into session and then back out of session after the if statement then $msg will still hold whatever it was initially set to (in this case an empty string). Why isn't it set in the if statement? Okay so after echoing awardType it says Match which would mean it would go to the else part of the statement but it doesn't. It still shows the dropdown for the characters and don't know why? Code: [Select] <?php require ('php/awardsshowNom.php'); ?> <script type="text/javascript" src="forms/edit/js/awardsshowNom.js"></script> <!-- Form --> <form action="#" id="awardsshowNomForm" > <fieldset> <legend>Edit Award Nominations</legend> <?php echo $awardType; ?> <?php if ($awardType = 'Singular') { ?> <div class="field required"> <label for="nominees">Nominees</label> <select class="dropdown" name="charactersDrop" id="charactersDrop" title="Characters Drop"> <option value="">- Select -</option> <?php while ( $row = mysqli_fetch_array ( $charactersResult, MYSQL_ASSOC ) ) { print "<option value=\"".$row['ID']."\">".$row['characterName']."</option>\r"; } ?> </select> <input type="button" value="Add Character" class="" onclick="HandlerCharacters()"/> <ul id="characterList"> </ul> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <? } else { ?> <div class="field required"> <label for="nominees">Nominees</label> <select class="dropdown" name="events" id="events" title="Events for <?php echo date("Y") ?>"> <option value="">- Select -</option> <?php while ( $row = mysqli_fetch_array ( $matchResult, MYSQL_ASSOC ) ) { print "<option value=\"".$row['ID']."\">".$row['segmentTitle']."</option>\r"; } ?> </select> <input type="button" value="Add Match" class="" onclick="AddMatch()"/> <ul id="matchList"> </ul> <span class="required-icon tooltip" title="Required field - This field is required, it cannot be blank, and must contain something that is different from emptyness in order to be filled in. ">Required</span> </div> <?php } ?> <input type="hidden" name="awardID" id="awardID" value="<?php echo $awardID; ?>" /> <input type="hidden" name="awardShowID" id="awardShowID" value="<?php echo $awardShowID; ?>" /> <input type="hidden" name="awardName" id="awardName" value="<?php echo $awardName; ?>" /> <input type="submit" class="submit" name="editAwardNom" id="editAwardNom" title="Edit Award Nominees" value="Edit Awards Nominees"/> </fieldset> </form> <!-- /Form --> <!-- Messages --> <div class="message message-error"> <h6>Required field missing</h6> <p>Please fill in all required fields. </p> </div> <div class="message message-success"> <h6>Operation succesful</h6> <p>Arena was added to the database.</p> </div> <!-- /Messages --> What's the correct syntax for having a variable in a select statement? Here's an example of what I'm trying to do (after I'm already connected to the database). Code: [Select] $username = "thomas"; $query = mysql_query( "SELECT * from users WHERE username = $thomas" ); if( mysql_num_rows( $query ) > 0 ) { bla bla... It works if I don't put the WHERE part in, but I get an error if I use it, so I'm assuming I have the wrong syntax for using a variable in the select statement. basically, I have one calculation that relies on the value returned by an if statement, but i can;t for the life of me figure it out correctly... Here is what i am trying to accomplish: Here is the code for the IF i need to get the value of if ($loadedMiles < 500) { (500 - $loadedMiles) * .25 * $mainRate; } And here is the reason why i need it: if ($loadSize == "Full") { $loadedmiles + thevalueoftheif; } basically i will need to have a way to get the values of the functions in the IF statements if that makes any sense... thanks in advance! Hi, My issue here is that I cant get my query string variables to ONLY feed into if/else statement on my secondary page. I include my secondary page (fine.php) from my index page. My query string variables keep being fed back into my original if/ese statement on index.php. here is the if/else on index.php (these links work fine): <?php if($_SERVER['QUERY_STRING']=='/index.php' || $_SERVER['QUERY_STRING']=='') { include 'port.php'; } elseif (isset($_GET['pos'])){ include 'pos.php'; } elseif (isset($_GET['web'])){ include 'web.php'; } elseif (isset($_GET['fine'])){ include 'fine.php'; } else {include '404.php';} here is the if/else on my secondary page (fine.php). These links are supposed to alert the if/else in the next table cell. However, they instead alert the if/else in index.php. <td><br/> <a href="?backset"><img src="fine/thumbs/x-backset.jpg" border="0"></a><br/><br/> <a href="?backside"><img src="fine/thumbs/x-backside.jpg" border="0"></a><br/><br/> <a href="?bannerprint"><img src="fine/thumbs/x-bannerprint.jpg" border="0"></a><br/><br/> <a href="?chopu"><img src="fine/thumbs/x-chopu.jpg" border="0"></a><br/><br/> </td> <td><br/> <div id="DivPiece" align="left"> <?PHP if (isset($_GET['backset'])){ include 'fine/backset.php'; } elseif (isset($_GET['backside'])){ include 'fine/backside.php'; } elseif (isset($_GET['bannerprint'])){ include 'fine/bannerprint.php'; } elseif (isset($_GET['chopu'])){ include 'fine/chopu.php'; } ?> </div> </td> How can I get the links on the secondary page to only alert the if/else statement on that page, and BLOCK the if/else statement on index.php from seeing them? I still want to use the query string though. Thanks! [/quote] I'm having an issue with holding a session variable in the statement below $Color is losing its value in the if statement. For example int the ( ) $Color is a zero while in the echo part $Color is being displayed correctly as Blue. OK, I think I have confused this code and it is not calculating correctly. $ckifdue = mysql_query("SELECT * FROM accounting WHERE ClientID = '$clientid'") or die(mysql_error()); while($ckdue =mysql_fetch_array($ckifdue)){ if($ckdue['AmountDue'] == "0"){ $_SESSION['MONEYOWED'] = "0.00"; } else { $_SESSION['MONEYOWED'] = $_SESSION['MONEYOWED'] + $ckdue['AmountDue']; } if($ckdue['Amount1RS'] == "Balance Due"){ $totcol = $ckdue['TotalCollected']; echo " total collected:" . $totcol; $monpaid = $_SESSION['MONEYPAID']; echo "money paid in:" . $monpaid; $_SESSION['MONEYPAID'] = $totcol + $monpaid; echo "session money paid:" . $_SESSION['MONEYPAID']; } } $moneypaid = $_SESSION['MONEYPAID']; $moneyowed = $_SESSION['MONEYOWED']; echo "money paid:" . $moneypaid; echo " money owed:" . $moneyowed; $moneyowed = $moneyowed - $moneypaid; unset($_SESSION['MONEYOWED']); unset($_SESSION['MONEYPAID']); The echos look like: total collected:100.00money paid in:200session money paid:300 total collected:100.00money paid in:300session money paid:400money paid:400 money owed:0.00 There should be $100 due, $200 paid, so a balance of -100. There is 2 balance due reciepts, this is just not calclating right in the sessions. Code: [Select] echo("<p class=\"commentboxContainer\"><table width=100% border=0> <tr> <td bgcolor=\"#EEE\"><strong><p class=fltlft>$name </strong>says:</p></td> </tr> </table> <table width=100% border=0 bgcolor=\"#EEE\"> <tr> <td width=40%><img src=../images/Icons/People/Anonymous.png width=64 height=64 border=1 /></td> <td width=60%>$comment',0,6</td> </tr> </table> <table width=100% border=0> <tr> <td bgcolor=\"#EEE\" ><p class=fltlft><em>$email</em></p></td> </tr> <tr> <td bgcolor=\"#EEE\" ><p class=fltlft>added on $time</p></td> </tr> </table></p><br>"); Here's my echo statement for displaying comments by users. I want to add a substr (); function to limit the amount of characters of the $comment field. That way if a user makes a long comment it doesn't push the page down. I tried putting it after the echo (); but that didn't work. I also tried putting it before $comment and that didn't even work. I know that if I make two separate echo statements, this can be done, but the field "$comment" is displayed within a table that is part of the original echo statement, so what do I do? I want to display some specific data from my database (just data from a given date). I first created a page where the user picks the date. After the date is defined it is passed to the next page where the data from that date is displayed. That page includes a form where users can edit the data. The form data is then passed to a third page for processing. All of this works fine. Now I want the user to be taken back to the previous page with the assigned date. On the processing page I am using this statement: Code: [Select] header("Location: /teetimes/adminteetimes.php?teetimedate=$dateID");and on the display page I'm using Code: [Select] $dateID = $_REQUEST[teetimedate];The display page is using a SELECT...WHERE Date='$dateID' statement and $dateID is defined in the processing page. Problem is: I'm redirected from the processing page back to the display page but the date isn't passed, so the correct data isn't being displayed. Can anyone help me pass a variable using a header?? Or show me where my logic is lacking?? Thanks! I have to put a link that can be clicked around the first name and last name variables in the echo statement below. I also need to add a variable from the Select query to the link such as: 'www.phpfreaks.com/admin/customers.php?page=1&cID="VARIABLE HERE" &action=edit' I've tried a bunch of things and none seem to work. while($row = mysql_fetch_array($result)){ echo '<tr><td>' . $row['customers_firstname'] . " " . $row['customers_lastname'] . '</td><td>' . date("M. d, Y", strtotime($row['date'])) . '</td><td>' . $row['plan_id'] . '</td></tr>'; David Hello all, I am a beginner at PHP and trying to form an IF statement, I'm running into a problem which I cannot seem to solve. Due to my lack of syntax knowledge I would appreciate if someone could point me in the right direction. The combo variables are sent to this page through a form and defined as these variables at the top of the page. e.g $combo0 = $_POST["combo0"]; When the results are displayed any form field which was left blank or empty I want to show "N/A" if data is detected in being sent through the form I then want the "Else" statement to take affect. Currently when I run the below statement N/A is echoed despite if data was sent through the form fields or not.... if (empty($scrap)) { echo "<h3>Submitted Scrap Results</h3> No scrap parts were booked off"; } elseif (empty($combo0) || empty($combo1) || empty($combo2) || empty($combo3) || empty($combo4)) { echo "N/A"; } else { echo "<h3>Submitted Scrap Results</h3> <b>Reason:</b> " .$combo0." - ".$combo1." - ".$combo2." - ".$combo3." - ".$combo4." <br /> <b>on machine</b> " .$mid. " - <b>No. Scrap</b> " .$noscrap. ""; } Anyone any ideas? I have a script that adds points together based upon the placing. This is the actual script: Code: [Select] <? $points = 0; if($place === '1st') {$points = $points + 50;} elseif($place === '2nd') {$points = $points + 45;} elseif($place === '3rd') {$points = $points + 40;} elseif($place === '4th') {$points = $points + 35;} elseif($place === '5th') {$points = $points + 30;} elseif($place === '6th') {$points = $points + 25;} elseif($place === '7th') {$points = $points + 20;} elseif($place === '8th') {$points = $points + 10;} elseif($place === '9th') {$points = $points + 10;} elseif($place === '10th') {$points = $points + 10;} elseif($place === 'CH') {$points = $points + 50;} elseif($place === 'RCH') {$points = $points + 40;} elseif($place === 'TT') {$points = $points + 30;} elseif($place === 'T5') {$points = $points + 30;} elseif($place === 'Champion') {$points = $points + 50;} elseif($place === 'Reserve Champion') {$points = $points + 40;} echo "Total HF Points: $points"; ?>What it *should* do (my friend's script works the same way and it works) it starts at points = 0, than if there is a first place, it adds 50, and so forth until it reaches the end. It is included into a file, in this area: Code: [Select] <div class="tabbertab"> <h2>Records</h2> <? $query92 = "SELECT * FROM THISTABLE WHERE VARIABLE='$id' OR VARIABLE = '$name' ORDER BY ABS(VARIABLE), VARIABLE"; $result92 = mysql_query($query92) or die (mysql_error()); echo "<table class='record'> <tr><th>Show</th> <th>Class</th> <th>Place</th></tr> "; while($row92 = mysql_fetch_array($result92)) { $class = $row92['class']; $place = $row92['place']; $entries = $row92['entries']; $race = $row92['show']; $purse = number_format($row92['purse'],2); echo "<tr><td>$race</td> <td>$class</td> <td>$place</td></tr>"; } ?> <tr><td colspan='3'><div align='right'><? include('includes/points.php'); ?></div></td></tr> </table> </div> This is the code that is relevant. When ended here, it echoes the last place that appears in the results (such as a 5th place echoing 30 points). When I move it to be included in the while loop, it shows Total Points: 50 Total Points: 25 Total Points: 10 (depending on the results displayed on that page). What am I doing wrong? Hello everyone, I can get Test 2 to successfully operate the if statement using a variable variable. But when I try the same method using a session variable (Test 1) the if statement is not executed. Please could you tell me why the if statement in Test 1 is not being executed? Code: [Select] <?php # TEST 1 $_SESSION[test_variable] = "abcd"; $session_variable_name = "_SESSION[test_variable]"; if ($$session_variable_name == "abcd") { echo "<br>line 373, abcd<br>"; } # TEST 2 $test_variable = "efgh"; $test_variable_name = "test_variable"; if ($$test_variable_name == "efgh") { echo "<br>line 379, efgh<br>"; } ?> Many thanks, Stu Please take a look at the following code (this would work if the statement was SELECT instead of UPDATE) But I need to grab the following: Code: [Select] $result = mysql_query("UPDATE `AUCTIONS_MAIN` SET Current_Price = Current_Price + '$increase_price', Last_Bidder_Time = '$last_bidder_time' WHERE PId = '$id'"); //grab the new updated current price to save on different bidding history DB while($row=mysql_fetch_array($result)) { $current_price = $row['Current_Price']; } As you can see, I need to give the new Current_Price value to the $current_price variable. Obviously the while function is incorrect, I would really appreciate any ideas and/or suggestions on how I can grab this value. PS: I can't make a new query call with a select statement in order to know the new Current_Price. I need the direct updated value coming from the Update Statement, is this possible? Thanks a lot in advance!! I'm trying to input the results from a query into html, but I'm just getting the variable names rather than their values. I used single quotes for the echo statement, but I think I must need to switch to double to do that. But then I have problems with the double quotes from the class names (ex. class="SideBoxTitle"). Code: [Select] <?php // get user's videos from database $conn = mysqli_connect($dbhost, $dbuser, $dbpass) or die("MySQL Error: " . mysql_error()); $query = "SELECT * FROM haas12_test.videos"; $result = mysqli_query($conn, $query) or die ("Couldn't execute query."); while($row = mysqli_fetch_assoc($result)) { extract($row); echo ' <div id="topBox" class="mainVideoSideBoxes" > <div class="SideBoxTitle" ><h3> $vidtitle </h3> </div><!-- close SideBoxTitle --> <div class="sideBoxVidContainer"> <div class="SideBoxScreenCast" > $vidurl </div><!-- close SideBoxScreenCast --> <div class="SideBoxDesc" ><p> $viddesc </p> </div><!-- close SideBoxDesc --> </div><!-- close sideBoxVidContainer --> </div><!-- close mainVideoSideBoxes --> </div><!-- close mainVideoSideBoxes --> '; // end echo staement } ?> Hi there im having trouble with my If statement in that its not doing what it is suppose to do! I have a do loop that and If statament that checks that resultp < results. If it is less then an echo is suppose to happen, but its not. Im getting notice errors: Undefined index: Class1- 4 but nothing is outputted. I checked the records in the database so the condition will happen but nothings happening. Help Code: [Select] <?php do { ?> <?php echo $row_resultp['Class1_totla']; echo ' Class 1'; echo'<br>'; echo $row_resultp['Class2_totla']; echo ' Class 2'; echo'<br>'; echo $row_resultp['Class3_totla']; echo ' Class 3'; echo'<br>'; echo $row_resultp['Class4_totla']; echo ' Class 4'; echo'<br>';echo'<br>';echo'<br>'; echo $row_results['Class1_totlas']; echo ' Class 1'; echo'<br>'; echo $row_results['Class2_totlas']; echo ' Class 2'; echo'<br>'; echo $row_results['Class3_totlas']; echo ' Class 3'; echo'<br>'; echo $row_results['Class4_totlas']; echo ' Class 4'; if ($row_resultp['Class1'] < $row_results['Class1']){ echo 'you need'; echo $row_resultp['Class1'] - $row_results['Class1']; echo 'more'; } if ($row_resultp['Class2'] < $row_results['Class2']){ echo 'you need'; echo $row_resultp['Class2'] - $row_results['Class2']; echo 'more';} if ($row_resultp['Class3'] < $row_results['Class3']){ echo 'you need'; echo $row_resultp['Class3'] - $row_results['Class3']; echo 'more'; } if ($row_resultp['Class4'] < $row_results['Class4']){ echo 'you need'; echo $row_resultp['Class4'] - $row_results['Class4']; echo 'more'; } ?> <?php } while ($row_resultp = mysql_fetch_assoc($resultp) && ($row_results = mysql_fetch_assoc($results))); ?> Hello guys, I am having an issue with my if statement. Basically what I am trying to do is when there are no photos uploaded then enter default image. Like I said doesn't look like my if stmt is working at all.. Any ideas? foreach (glob("temp_photo/$subn*.*") as $filename) { //echo "$filename<br>"; $string = $filename; $filename2 = basename($string); if($filename2 == ""){ $filename2="/images/default.jpg"; } // Insert ad details into mysql $query = "INSERT INTO ads (ad_type,ad_title,ad_body,ad_category,ad_photo,ad_member,ad_status,ad_city,ad_state,ad_zip)VALUES('".$ad_type."','".$ad_title."','".$ad_body."','".$catid."','".$filename2."','".$vname."','".$ad_status."','".$city."','".$state."','".$zip."')"; // Error checking to see if the query was successful $result = mysql_query($query) or die (mysql_error()."in <br>$query" ); Hello Everyone, From time to time, I get into a situation where my if statements do not give the desired results. I always have to play around with them to get the things working. I'm in same situation right now. I'm guessing that I do not completely understand the logic. If someone can take a look at the code below and tell me what's wrong, it will be greatly appreciated. if($_SESSION['account_type'] != 'internal admin'){ die('<font color="red"><b>Error:</b> This page can only be accessed by internal or super admin.</font>'); break; } elseif($_SESSION['account_type'] != 'super admin'){ die('<font color="red"><b>Error:</b> This page can only be accessed by internal or super admin.</font>'); break; } I have echoed out the $_SESSION['account_type'] and I'm getting "internal admin" but for some reason, I'm getting the error "Error: This page can only be accessed by internal or super admin." Thanks in advance for your help. Jatt Surma now i am trying to get this to work it should change the variable if the statement is ture and it not in that and any one help include'db.php'; $sql2=mysql_query("SELECT * FROM site_config WHERE id=1")or die(mysql_error()); while($row2=mysql_fetch_array($sql2)) { $paypal_email=$row2['paypal_email']; $price=$row2['price']; $sandbox=$row2['sandbox']; $account_number=$row2['account_number']; $quantity_1=$row2['quantity_1']; $product=$row2['product']; $return_url=$row2['return_url']; $demo=$row2['demo']; if($sandbox==1) { $link='http://www.sambob.info'; if(empty($sandbox)) { $link='http://www.bob.tdsnet.org'; } echo"$link<br>$sandbox"; } } |