PHP - Echoing Search Variables..
Hey all,
I'm using $_POST to post search variables from a search form i have made for my site. Below is the code for the search form: Code: [Select] <form method="post" action="results.php"> <p class="label">Airline </p><p class="right"> <select style="width: 200px;" name="airline" id="airline"> <option selected="selected" value=""> All Airlines</option> <?php $query=mysql_query("SELECT * FROM photos GROUP BY airline, aircraft ORDER BY airline"); while($row = mysql_fetch_assoc($query)){ echo '<option value="'.$row['airline'].'">'.$row['airline'].'</option>'; } ?> </select></p><br /><br /> <p class="label">Aircraft </p><p class="right"> <select style="width: 200px;" name="aircraft" id="aircraft"> <option selected="selected" value=""> All Aircraft</option> <?php $query=mysql_query("SELECT * FROM photos GROUP BY aircraft ORDER BY aircraft"); while($row = mysql_fetch_assoc($query)){ echo '<option value="'.$row['aircraft'].'">'.$row['aircraft'].'</option>'; } ?> </select></p><br /><br /> <p class="label">Registration </p><p class="right"><input type="text" style="width: 198px;" class="text" name="registration" id="registration" value="" /></p><br /><br /> <p class="label">Construction Number </p><p class="right"><input type="text" style="width: 198px;" class="text" name="cn" id="cn" value="" /></p><br /><br /> <p class="label">Location </p><p class="right"> <select class="select" style="width: 200px;" name="location" id="location"> <option selected="selected" value=""> All Locations</option> <?php $query=mysql_query("SELECT * FROM photos GROUP BY location ORDER BY location"); while($row = mysql_fetch_assoc($query)){ echo '<option value="'.$row['location'].'">'.$row['location'].'</option>'; } ?> </select></p><br /><br /><br /> <div class="options2"></div><br /><br /> <p class="label">Genre </p><p class="right"><select class="select" style="width: 200px;" name="class" id="class"> <option selected="selected" value=""> All Genres</option> <option> Airliner</option> <option> Cargo</option> <option> Executive/Private</option> <option> General Aviation</option> </select></p><br /><br /> <p class="label">Aspect/Subject </p><p class="right"><select class="select" style="width: 200px;" name="aspect" id="aspect"> <option selected="selected" value=""> All Aspects</option> <option> Cabin View</option> <option> Close Up</option> <option> Flight Deck</option> <option> Front View</option> <option> Rear View</option> <option> Side Profile</option> </select></p><br /><br /> <p class="label">Scheme </p><p class="right"> <select class="select" style="width: 200px;" name="scheme" id="scheme"> <option selected="selected" value=""> All Schemes</option> <option> Basic</option> <option> Extra Stickers</option> <option> Hybrid</option> <option> Special</option> <option> Standard</option> </select></p><br /><br /> <p class="label">Situation/Phase</p><p class="right"> <select class="select" style="width: 200px;" name="situation" id="situation"> <option selected="selected" value=""> All Situations</option> <option> Approach</option> <option> Departure</option> <option> Ground</option> </select></p><br /><br /> <p class="label">Time</p><p class="right"> <select class="select" style="width: 200px;" name="tod" id="tod"> <option selected="selected" value=""> All Times of Day</option> <option> Dawn and Dusk</option> <option> Day</option> <option> Night</option> </select></p><br /><br /><br /> <p class="label">Order By</p><p class="right"> <select class="select" style="width: 110px;" name="order" id="order"> <option selected="selected" value=""> Photo #</option> <option> Aircraft</option> <option> Airline</option> <option> Date of Photo</option> <option> Location</option> <option> Registration</option> </select> </p> <p class="right"> <br /><br /> <input type="submit" name="submit" id="submit" value=" Search " /> <input type="reset" name="reset" id="reset" value=" Reset " /> </form> On the results page i have this script: Code: [Select] if(!empty($_POST)) { $criteria= implode('</strong> > <strong>', array_map('htmlentities', $_POST)); } <p class="resulttext">Your search <?php if(!empty($_GET)) { echo 'for ';} ?> <strong><?php echo $criteria;?></strong> returned <strong><?php echo $num;?></strong> photo results, these are displayed below.</p> to echo the search variable. For example if someone used the form to search for 'British Airways' and 'London Heathrow', the results page would read: results.php?airline=British+Airways&location=London+Heathrow Your search for British Airways > London Heathrow has returned X photo results.... Although this is working; because there is often alot of form options not used, the url turn's out to be: results.php?airline=British+Airways&location=London+Heathrow&aircraft=®istration=&blah=&blah=&submit=search .....etc Which then reads as: Your search for British Airways > London Heathrow > > > > > SEARCH has returned X photo results.... as seen below in this pictu Is there anyway to stop this from happening and just echo the search field which !="" Thanks In Advanced! Similar TutorialsHello. I have an array like this: Code: [Select] Array ( [1] => MOR [2] => CON [3] => CP1 [4] => CP2 [5] => EMAIL [6] => NIF [7] => BI [8] => DIS ) And then I defined, for example this one variable: define("DIS","District"); When I try to... echo $array[8]; All I get is "DIS". I'm obviously trying to echo a string and it won't work that way... but I still gave it a try. How can I do this then? I need "District" to be outputted instead of the actual variable name. I know that if I were to "echo DIS;" this would work but that defeats the purpose as I have various defined variables per row... Thanks. Hey All. Say someone was searching my photo database website from a drop down menu. They search for the aircraft: 'Boeing 747' and airline: 'British Airways', which is posted with the url 'result.php?aircraft=Boeing+747&airline=British+Airways'. How would i get my php to echo: Your search for 'Boeing 747 > British Airways' is displayed below: Or if the search was for just: Aspect: Flightdeck, echo: Your search for 'Flightdeck' is displayed below: I hope it's clear, Thanks, Jimmy What would be the correct way to use returned sql results as variables. I have tried the way in my script, but Im unsure of how I can echo just one of the $nt variables further on in my script. $code = $_GET['postcode']; $shortcode = substr($code,0,2); $query =mysql_query ("SELECT email FROM treesurgeons WHERE postcode like '%" . $shortcode . "%' ORDER BY companyName LIMIT 3"); echo mysql_error(); echo "<p>The email addresses you have requested are;</p>"; while($nt=mysql_fetch_row($query)){echo "$nt[0],$nt[1],$nt[2]<br>";} echo "<p>please use $nt[2] if you ever want to contact me</p>"; //this line doesnt work for me ?></body></html> is there is a way to assign variables such as; $nt[0] = $firstemail $nt[1] = $secondemail $nt[2] = $thirdemail this way I could use each of my sql values, just as I would any other variable? Hi, I have been trying for 2 days to get this to work. I am trying to put in a list of search keywords in the form, run a LIKE query on the database, and echo out all of the matching terms. Please if someone could please show me how to echo out this information I would be very grateful. Thank you. Code: [Select] <?php $host = ""; $database = ""; $username = ""; $password = ""; $tbl_name = "users"; $conn = mysql_connect($host, $username, $password) or die("Could not connect: " . mysql_error()); mysql_select_db($database); include('bouncer.php'); $currentUser = $_SESSION['myusername']; if(isset($_POST['submit'])) { $first = mysql_real_escape_string( $_POST['first']); $last = mysql_real_escape_string( $_POST['last']); $dob = mysql_real_escape_string( $_POST['dob']); $gender = mysql_real_escape_string( $_POST['gender']); $ethnic = mysql_real_escape_string( $_POST['ethnic']); $country = mysql_real_escape_string( $_POST['country']); $state = mysql_real_escape_string( $_POST['state']); $town = mysql_real_escape_string( $_POST['town']); $zip = mysql_real_escape_string( $_POST['zip']); $email = mysql_real_escape_string( $_POST['email']); $hobbies = mysql_real_escape_string( $_POST['hobbies']); $job = mysql_real_escape_string( $_POST['job']); $business = mysql_real_escape_string( $_POST['business']); $religion = mysql_real_escape_string( $_POST['religion']); $social = mysql_real_escape_string( $_POST['social']); $political = mysql_real_escape_string( $_POST['political']); $affiliations = mysql_real_escape_string( $_POST['affiliations']); $buying = mysql_real_escape_string( $_POST['buying']); $selling = mysql_real_escape_string( $_POST['selling']); $likes = mysql_real_escape_string( $_POST['likes']); $dislikes = mysql_real_escape_string( $_POST['dislikes']); $links = mysql_real_escape_string( $_POST['links']); //THE SEARCH FUNCTION $result = mysql_query ( "SELECT * FROM users WHERE dob LIKE '%$dob%' OR gender LIKE '%$gender%' OR race LIKE '%$ethnic%' OR job LIKE '%$job%' OR country LIKE '%$country%' OR state LIKE '%$state%' OR town LIKE '%$town%' OR zip LIKE'%$zip%' OR hobbies LIKE'%hobbies%' OR business LIKE '%$business%' OR religion LIKE'%$religion%' OR social_groups LIKE '%$social%' OR political_groups LIKE'%$political%' OR other_affiliations LIKE ' %$affiliations%' OR buying LIKE '%$buying%' OR selling LIKE '%$selling%' OR links LIKE '%$links%' OR likes LIKE '%$likes%' OR dislikes LIKE'%$dislikes%'"); if (!$result) { echo 'Could not run query: ' . mysql_error(); exit; } $row = mysql_fetch_row($result); echo $row[0]; echo $row[1]; // I HAVE NO IDEA WHERE TO GO FROM HERE. } ?> <html> <body> <p>Login Successful</p> <p> </p> <form action="login_success6.php" method="post"> <p> <input type="text" name="first" size="20" /> First name<br /> <input type="text" name="last" size="20" /> Last name<br /> <input name="dob" type="text" size="20" id="dob" /> Date of Birth<br /> <input type="text" name="gender" size="20" id="gender" /> Gender <br /> <input type="text" name="ethnic" size="20" id="ethnic" /> Ethnicity <br /> <input type="text" name="country" size="20" id="country" /> Country<br /> <input type="text" name="state" size="20" id="state" /> State<br /> <input type="text" name="town" size="20" id="town" /> Town<br /> <input type="text" name="zip" size="20" id="zip" /> Zip Code<br /> <br /> <input type="text" name="email" size="40" id="email" /> Email<br /> <textarea name="job" cols="40" id="job"></textarea> Job<br /> <textarea name="business" cols="40" id="business"></textarea> Business<br /> <input type="text" name="religion" size="60" id="religion" /> Religion</p> <p><br /> <textarea name="social" cols="100" id="social"></textarea> Social Groups<br /> <textarea name="political" cols="100" id="political"></textarea> Political groups<br /> <textarea name="affiliations" cols="100" id="affiliations"></textarea> Other Affiliations<br /> <textarea name="buying" cols="100" id="buying"></textarea> Items I am buying<br /> <textarea name="selling" cols="100" id="selling"></textarea> Items I am selling<br /> <textarea name="likes" cols="100" id="likes"></textarea> My likes <br /> <textarea name="dislikes" cols="100" id="dislikes"></textarea> My dislikes <br /> <textarea name="links" cols="100" id="links"></textarea> My links <br /> <input type="submit" name="submit" value="Store in database and search" /> <input type="reset" value="Reset fields" /> </p> </p> </form> </body> </html> The result pages is supposed to have pagination like google help me please
Hello guys, I want to get the values of 3rd level of my referral but it did not echo any value but if i put the ref id directly on the code, it will echo the values. why is it so? or am i doing it the wrong way? in my database i have a table test_referral id acct_name ref_id refer_id 1 john J1234 0 2 bull B3456 J1234 3 doe D5567 J1234 4 frank F7788 J1234 5 jimmy J9990 J1234 6 tommy T6784 F7788 7 tom T9988 F7788 8 girly G8866 D5567 9 fred F0099 J9990 10 ronaldo R7722 B3456 thanks $stmt= $pdo->query("SELECT * FROM test_referral WHERE acct_name='Chidi Okafor'"); $parent = $stmt->fetch(PDO::FETCH_LAZY); echo "<ul><li>"; echo $parent['acct_name']; $ref_id = $parent['ref_id']; echo "</li><ul>"; $stmt= $pdo->query("SELECT * FROM test_referral WHERE refer_id='$ref_id'"); $child_count = $stmt->rowCount(); while($child = $stmt->fetch(PDO::FETCH_LAZY)){ echo "<li>"; echo $child['acct_name']; $ref_ids = $child['ref_id']; echo "</li>"; } //$reff = "F7788"; //$stmt= $pdo->query("SELECT * FROM test_referral WHERE refer_id='$F7788'"); $stmt= $pdo->query("SELECT * FROM test_referral WHERE refer_id='$ref_ids'"); $child_count2 = $stmt->rowCount(); while($children = $stmt->fetch(PDO::FETCH_LAZY)){ echo "<ul><li>"; echo $children['acct_name']; echo "</li></ul>"; } Edited by Mr-Chidi, 25 December 2014 - 05:34 AM. $lastfm = file_get_contents('http://www.last.fm/group/Rishloo/members'); $users = explode('" id="r4_', $lastfm); $users = explode('">', $users[1]); var_dump($users[0]); that is only echoing one ID http://www.last.fm/group/Rishloo/members 1 id for each member it should be echoing.. any idea why it isnt? $lastfm = file_get_contents('http://www.last.fm/group/Rishloo/members'); $grab_id=explode('" id="r4_', $lastfm); for($b=1; $b<count($grab_id); $b++){ $getid=explode('">', $grab_id[$b]); echo count($getid[0]); } that echos all 1's.. any help is appreciated.. thanks thanks This problem is existing on a few pages so I'll be in the clear if I can figure out to solve it on one page. Problem is on form submission its still echoing back that sortorder variable which makes it hard for it to compare on the success function to display the right message because the message should be good, bad1, bad2, ... . So is there anyway around that or do I need to do something on the client side of the form page. <?php // Include the database page require ('../inc/dbconfig.php'); if ( isset( $_POST['menuid'] ) ) { $menuid = (int)$_POST['menuid']; $query = "SELECT COUNT(sortorder) AS numOrder FROM `menuitems` WHERE `menu_id` = '".$menuid."'"; $result = mysqli_query ($dbc, $query); $row = mysqli_fetch_array( $result, MYSQL_ASSOC ); $sortorder = $row[ 'numOrder' ] + 1; echo $sortorder; } if (isset($_POST['submitmenuitem'])) { $menuid = mysqli_real_escape_string($dbc, $_POST['menuid']); $itemname = mysqli_real_escape_string($dbc, $_POST['itemname']); $itemurl = mysqli_real_escape_string($dbc, $_POST['itemurl']); $sortorder = mysqli_real_escape_string($dbc, $_POST['sortorder']); $contentpage = mysqli_real_escape_string($dbc, $_POST['contentpage']); $newscategory = mysqli_real_escape_string($dbc, $_POST['newscategory']); $application = mysqli_real_escape_string($dbc, $_POST['application']); $query = "SELECT * FROM `menuitems` WHERE (`itemname` = '".$itemname."') OR (`itemurl` = '".$itemurl."') OR (`contentpage_id` = '".$contentpage."') OR (`application_id` = '".$application."') OR (`newscategory_id` = '".$newscategory."') AND `menu_id` = '".$menuid."'"; $result = mysqli_query ( $dbc, $query ); // Run The Query $rows = mysqli_num_rows($result); if ($rows == 0) { $query = "INSERT INTO `menuitems` (menu_id, itemname, itemurl, sortorder, contentpage_id, newscategory_id, application_id, creator_id, datecreated, enabled) VALUES ('".$menuid."','".$itemname."','".$itemurl."','".$sortorder."','".$contentpage."', '".$newscategory."', '".$application."', 1, NOW(), 0)"; mysqli_query($dbc, $query); echo "good"; } else { $row = mysqli_fetch_array($result); if (($row['itemname'] == $itemname) && ($row['newscategory_id'] == $newscategory)) echo 'bad9'; elseif (($row['itemname'] == $itemname) && ($row['application_id'] == $application)) echo 'bad8'; elseif (($row['itemname'] == $itemname) && ($row['contentpage_id'] == $contentpage)) echo 'bad7'; elseif (($row['itemname'] == $itemname) && ($row['itemurl'] == $itemurl)) echo 'bad6'; elseif ($row['newscategory_id'] == $newscategory) echo 'bad5'; elseif ($row['application_id'] == $application) echo 'bad4'; elseif ($row['contentpage_id'] == $contentpage) echo 'bad3'; elseif ($row['itemurl'] == $itemurl) echo 'bad2'; elseif ($row['itemname'] == $itemname) echo 'bad1'; } } if (isset($_POST['deletemenuitem'])){ $menuitemID = (int)$_POST['menuitemID']; $query = "UPDATE `menuitems` SET `enabled` = '1' WHERE `id` = '".$menuitemID."' LIMIT 1"; mysqli_query($dbc,$query); } ?> Hello, I have a PHP page (below) that is suppose to update a field in my database. For some reason it does not update. I am trying to echo that sql with this script. Any help would be greatly appreciated. Thanks JR Code: [Select] $p = (100-$_POST[$c])/100; $sql = "delete from products_groups where customers_group_id = ".$sppc['customers_group_id']; echo $sql; tep_db_query($sql); $sql = "insert into products_groups select '". $sppc['customers_group_id'] ."' as customers_group_id, ( " . $p . " * p.products_price) as customers_group_price, p.products_id from products p"; echo $sql; tep_db_query($sql); Below is the complete code, Code: [Select] <?php require('includes/application_top.php'); ?> <!DOCTYPE html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <link rel="stylesheet" type="text/css" href="includes/stylesheet.css"> <script language="javascript" src="includes/general.js"></script> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF" onload="SetFocus();"> <div id="popupcalendar" class="text"></div> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'template_top.php'); ?> <!-- header_eof //--> <?php if (isset($_POST['Update'])) { $sppc_query_raw = "select * from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id"; $sppc_query = tep_db_query($sppc_query_raw); while( $sppc = tep_db_fetch_array( $sppc_query ) ) { if ($sppc["customers_group_name"] != "Retail"){ //$sppc['customers_group_id'] $c = "CG_".$sppc['customers_group_id']; $tmp = $_POST[$c]; if ($tmp != 0) { $p = (100-$_POST[$c])/100; tep_db_query("delete from products_groups where customers_group_id = ".$sppc['customers_group_id']); tep_db_query ("insert into products_groups select '". $sppc['customers_group_id'] ."' as customers_group_id, ( " . $p . " * p.products_price) as customers_group_price, p.products_id from products p"); } //if not 0 } //if not Retail } } ?> <!-- body //--> <table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft"> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="100%"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo "Special Pricing Discount Setup"; ?></td> <td class="specialPrice" align="right"> </td> </tr> </table></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><table border="0" width="100%" cellspacing="2" cellpadding="2"> <tr class="dataTableHeadingRow"> <td class="dataTableHeadingContent" align="left"> <?php if (isset($_POST['Update'])) { echo "<center>Updated!</center>"; } ?> </td> </tr> <?php $sppc_query_raw = "select * from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id"; $sppc_query = tep_db_query($sppc_query_raw); while( $sppc = tep_db_fetch_array( $sppc_query ) ) { ?> <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)"> <td class="dataTableContent" align="left"> <?php if ($sppc["customers_group_name"] != "Retail"){ echo $sppc["customers_group_name"]; } if (isset($_POST['Update'])) { if ($sppc["customers_group_name"] != "Retail"){ $c = "CG_".$sppc['customers_group_id']; $tmp = $_POST[$c]; echo " Current Discount is $tmp%" ; } } ?> </td> </tr> <?php } ?> </table></td> </tr> <tr> <td valign="top"> <form action="" method="post"> <table border="0" width="40%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText" align="left"> </td> <td> </td> </tr> <?php $sppc_query_raw = "select * from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id"; $sppc_query = tep_db_query($sppc_query_raw); while( $sppc = tep_db_fetch_array( $sppc_query ) ) { if ($sppc["customers_group_name"] != "Retail"){ ?> <tr> <td class="smallText" align="left">Set New Percentage (%) Discount for <?=$sppc["customers_group_name"]?> :</td> <td><input name="CG_<?=$sppc['customers_group_id']?>" type="text" size="5" value="0"></td> </tr> <?php } } ?> <tr> <td colspan="2" align="center"><input type="submit" name="Update" value="Update"></td> </tr> </table> </form> </td> </tr> </table></td> <!-- body_text_eof //--> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> It is not outputting anything after the third echo. This is where it is http://sambender.com/brandon/review.php?subject=Math%20Problems echo "<table border='0'><tr><td><div id='question'><b>Question:</b><br/>$question</div></td></tr>"; echo "<tr><td><div id='answer' style='display:none;'><b>Answer:</b><br/>$answer</div>"; echo "<a href=\"javascript:showdiv('answer')\">Show Answer</a></td></tr>"; echo "<td><tr><a href='submitanswer.php?correct?=yes&correctid=$correctid>I got this correct!</a></tr></td></table>"; It just outputs Code: [Select] <table border='0'><tr><td><div id='question'><b>Question:</b><br/>What is your name?</div></td></tr><tr><td><div id='answer' style='display:none;'><b>Answer:</b><br/>Rooba holabint</div><a href="javascript:showdiv('answer')">Show Answer</a></td></tr><td><tr> i am having issues checking which value is checked in a form. here is my code for it: Code: [Select] <input type="radio" name="accountActivation" id="no" value="no" checked=" <? if (isset($register_errors)) { if (($_POST['accountActivation']) == "no") { echo "checked"; } } ?> " /> when i first open the page, no is checked. why is this, when there should be no errors, and the radio should not even be checked in the first place? I am probably making a dumb mistake...but heres the code... $gif = '.gif'; $jpg = '.jpg'; $jpeg = '.jpeg'; $png = '.png'; $jpeg1 = 'jpeg'; $gif1 = 'gif'; $jpg1 = 'jpg'; $png1 = 'png'; $max_file_size = '1048576'; $new_avatar = $_FILES['uploaded_avatar']['name']; $avatar_ext = end(explode('.', $new_avatar)); if (isset($_POST['change_submit1'])) { if ($_SESSION['logged_in'] != '1') { echo 'You need to be logged in!'; } elseif ($_POST['change_box1'] != 'CHANGE') { echo 'You must fill in the "CHANGE" box!'; } elseif (($uploaded_a_file == '1') && ($avatar_ext != $jpg1) && ($avatar_ext != $png1) && ($avatar_ext != $gif1) && ($avatar_ext != $jpeg1)) { echo 'File format not supported!'; } elseif ($uploaded_a_file != '1') { echo 'No file selected!'; } elseif ($_FILES["uploaded_avatar"]["size"] > $max_file_size) { echo 'File is too big!'; } } this is the code that should be echoing my avatar upload errors. Ive checked all the if statements ive changed the order around. still nothing. all of them work other than file format not supported. I can get this one to work...but at the cost of no file selected not working...help! i'm not sure whether this should be in this section or the ajax section. i'm trying to echo out an ajax script so that a page loads in a div tag after a link is clicked in the menu. Without the "echo", it works fine, but as soon as i include it within the "echo", it stops working. Any help would be great else echo" <div id='fcontrol'> <table border='1' class ='tstyle'> <tr height ='700'><td valign='top' class='ssbg' width='120'><div id='menu'> <a href='javascript:ajaxpage(''new_section.php'', ''contentarea'');'>Add new section</a><br/><br/> <a href='javascript:ajaxpage('new_sub_section.php', 'contentarea');'>Add new section to forum</a><br/><br/><a href='index.php'>Back to forum</a><br/><br/></div></td><td class='tcontrol' width='700' valign='top'> <center><div id='contentarea'>Control Panel</div></center></td></tr> </table></div> </div> "; ?> Hi, I am trying to insert a variable in the body of an email lik so: Code: [Select] $message = "Dear Administrator,\n\nthe following distributor\n\n'.$row_admin_login_RS['distributor_company_name'].'\n\nHas modified his Distributor information record.\n\"; I know it must be a syntax error...but I can't figure it out. Thanks Hi all, ive got a script witch im wanting to echo all the selected users in a table.. It selects and echos the users but just dosent add on to the table. <?php $themembers = mysql_query("SELECT * FROM users WHERE crew = '$user->crew'"); $ammoutmembers = mysql_num_rows($themembers); ?> <html> <head> <title>Crew Members || SD</title> </head> <body> <?php if ($crewstuff->boss == $username || $crewstuff->coowner == $username || $crewstuff->underboss == $username){ ?> <table width='80%' align='center' class='table' cellpadding='0' cellspacing='0' border='1'> <tr> <td class='header' colspan='3' align='center'>Current Crew Members</td> </tr> <tr> <td class='omg' align='center' width='40%'>Username</td><td class='omg' align='center' width='30%'>Rep</td><td class='omg' width='30%' align='center'>Kick</td> </tr> <?php if ($ammoutmembers != "0"){ while ($member11 = mysql_fetch_object($themembers)){ ?> <tr> <td width='40%'><?php echo("<a href='profile.php?viewuser=$member11->username' target='mainFrame'>$member11->username</a>"); ?></td><td width='30%'><?php echo ("".number_format($member11->rep).""); ?></td><td width='30%'><?php echo("<a href='?action=members&kick=$member11->username'>Kick</a>"); ?></td> </tr> <tr> <td colspan='3' class='omg' align='center'>Any member kicked is logged.</td> </tr> </table> <?php } // $member11 }// $ammoutmembers }elseif ($crewstuff->member == $username){ echo ("Your not being here , without being staff."); } ?> Is there way I can make it so it will be something like this layout: Username | Rep | Kick ---------------------------------- username | 0 | Kick username | 0 | kick For each user thats echoed? Thanks for help given Hey i'm just woundering how i would echo numbers from a database like 1000000 lets say 1 million how would i go about on echoing it like this 1,000,000 ZhsHero This code is suppose to echo out ALL the custom pages that are in the database, but it's only show ONE. Why is this? $query_get = mysql_query("SELECT COUNT(id),id,position,content,title FROM custom_pages ORDER BY id"); while($row = mysql_fetch_assoc($query_get)) { echo '<table border="0"> <tr><th><p>Title</p><td>'. $row['title'] .'</td></tr> <tr><th><p>Position</p><td>'. $row['position'] .'</td></tr> <tr><th><p>Action</p><td><a href="index.php?pages=1&delete='. $row['id'] .'">Delete</a> or <a href="index.php?pages=1&edit='. $row['id'] .'">Edit</a></td></tr> </table> '; } hi all, I have a piece of code which I coded where it selects all there cars out of the database and shows them, well it is meant to: $getall = mysql_query("SELECT car, id FROM garage WHERE owner='$username'"); $gotall = mysql_fetch_object($getall); echo "$gotall->car - $gotall->id<br />"; Its meant to echo out all the cars which the user own, but for some reason its only echoing one car. Can anyone see why its only showing one car with the id not all the cars they own? Thanks. Hi, this is how I echo some results from my DB: Code: [Select] <?php if(mysql_num_rows($execute)>0){ do{ echo " " .$result['id_cliente']. " " .$result['company_name']. " " .$result['cliente_tel']. " " ; }while($result = mysql_fetch_assoc($execute)); }else{ echo " No customer found. " ; } ?> and this echoes the results in one paragraph. I need to print the results in rows...and I need help with that. :shy:Thanks |