PHP - Quantified Results Based On A Few Variables Help!
Hello,
I am trying to get a page that shows a list of parts, with their quantities, condition and type. So parts that are identical are counted as 2, 3 etc if they are the same part, condition and type. But if one or more parts of the same type has any one of those variables different to the rest, it/they need to come out on a new line with the correct quantity against them. I have tried using arrays and I can get the quantities working against each part but don't know how to adapt it to achieve what I want. Here is what I have so far: // GET ALL THE PARTS FROM THIS **ONE SUPPLIER** AND FIND OUT THE QUANTITIES... include("../dbconnectlocal.php") ; $result = mysql_query("SELECT supplier, partNumber, newUsed, jobType, directIndirect, currency, vat, total FROM pourbaskets WHERE enquiryRef = '$enqId' AND supplier = '$sSup' ORDER BY partNumber DESC")or die(mysql_error()) ; $quantity = 0 ; $currentCount = 1 ; $partQuantityArray = array() ; // The box for our parts against their quantities. $partsBag = array() ; // For finding out how many unique parts there are later. $partCount = mysql_num_rows($result) ; // How many parts in total. while($row = mysql_fetch_assoc($result)) { // While we are going through each part found... $part = $row['partNumber'] ; $cond = $row['newUsed'] ; $jtyp = $row['jobType'] ; $curr = $row['currency'] ; $vat = $row['vat'] ; $tota = $row['total'] ; array_push($partsBag, $part) ; if($partCount == 1) { // Just one part... $quantity = 1 ; array_push($partQuantityArray, $part, $quantity) ; } if(!$prevItem && $partCount != 1 { // Is the first item and not the only one... $prevItem = $part ; // Set it to be the previous... $quantity++ ; // Increase quantity (to 1 now)... } elseif($currentCount == $partCount && $partCount != 1) { // If it's the last one in the list and not the only one... if($prevItem != $part) { array_push($partQuantityArray, $prevItem, $quantity) ; $quantity = 1 ; array_push($partQuantityArray, $part, $quantity) ; //$prevItem = $part ; } elseif($prevItem == $part) { // The final part is the same as the last one... $quantity++ ; array_push($partQuantityArray, $part, $quantity) ; } else { array_push($partQuantityArray, $part, $quantity) ; } } elseif($prevItem == $part) { // If the current item is the same as the last item... $quantity++ ; // Increase quantity... } elseif($partCount != 1) { // If it's a new item and not the only one, store the quantity of the last item, and start at 1... array_push($partQuantityArray, $prevItem, $quantity) ; $quantity = 1 ; $prevItem = $part ; } $currentCount++ ; } print_r($partQuantityArray) ;exit(); //////////////////// END OF QUANTITY FINDER ////////////////////////////// I have attached what I would like it to come out as. Similar TutorialsI'm very new to this and really could use some help. I've got a Web app that has one form that collects data from the user and puts it into a mysql database and has another form that allows the user to select critiera to find records in the database and display them on the page. All this is working just fine, but now that my database is getting more data in it, I want to add functionality to display 10 records on a page with results page navigation links so the user can move forward and backward in the results set. This part is not working and I've put in echo statements to figure out what the code is doing. The problem I'm having is that when the selection critiera pulls more than 10 records from the database, the first page of results is correct per the selection criteria entered by the user on the select form. When the 'next' link is selected to review the second page of results, the query is executed again. But this time the form variables have been reset and the results now contains the entire contents of the db. The start record is set to look at the 11th instance of the results set, so the second page starts with the 11th record in the database instead of the 11th record in the original results set. The original select statement is built by determining which criteria is selected using $_POST against each form variable. How can I retain the form variables or the original select statement so the second execution of the select statement results in the same results set as the first? The other option that may be better is to retain the original results set and avoid re-executing the select statement altogether. But I don't know how to do that either. Any suggestions, code samples or adivice is much appreciated! Hi Guys. Hopefully someone can help me with this...New to coding and pretty lost on this. I have a Mysql database which is displaying results to my webpage with no problems. However I would like to be able to add a combo box to my webpage that would update the mysql database results based on the combo box selection. For example if Ford is chosen from the combo box, the webpage would refresh and show all the results for Ford in the webpage. Can someone please help me? Here is the code I have at the moment that works just fine. But results of the database are based on the WHERE statement. Quote <?php $con = mysql_connect("server","database","password"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("a5525005_cars", $con); $result = mysql_query("SELECT * FROM `cars` WHERE Makel='Ford'"); echo "<table class='ex1' border='0' width='113%' style=text-align:center; cellpadding='6' cellspacing='0'> </tr>"; while($row = mysql_fetch_array($result)) { echo "<tr style=font-family:verdana;font-size:80%;>"; echo "<td width=13%>" . $row[""] . "<img src=\"" . $row["Photo"] . "\"></a>"; echo '<td width="14%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Model'] . '</a></td>'; echo '<td width="5%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Year'] . '</a></td>'; echo '<td width="4%"><a class="mylink" href="' . $row['URL'] . '">' . $row['Fuel'] . '</a></td>'; echo "</tr>"; } echo "</table>"; mysql_close($con); ?> I'm trying to pull results from a database based on where the user is located based upon the variables $usr_lat & $usr_lng, and search for by a radius of x amount of miles/km (need to make it optional). I can't seem to find exactly what I'm looking for on google so I thought I'd asked here. Any help would be appreciated.
How can i put returned values from an sql query, into variables. If the returned values from a query were; email1@com, email2@com, email3@com how would i go about puting them into variables? $value1 = (1st returned value from my sql query, in this case it would be email1@com) $value2 = (2nd returned value from my sql query, in this case it would be email2@com) $value3 = (3rd returned value from my sql query, in this case it would be email3@com) $code = $_GET['postcode']; $message = $_GET['message']; $emailad = "email@email.comuk"; $shortcode = substr($code,0,2); $result = mysql_query("SELECT email FROM treesurgeons WHERE postcode like '%" . $shortcode . "%' ORDER BY companyName LIMIT 3") or die(mysql_error()); echo "<h2>Business Names:</h2>"; while ($row = mysql_fetch_array( $result )) { $message .= "\r\n". $row['email'] ; } echo nl2br ($message); mail( "$emailad", "Header","$message" ); echo "<br>" . "Thank you for using our mail form."; ?> </body> </html> Thankyou for any ideas, or suggestions. hi I have 2 tables (members & friendship) Members table columns: -------------------------------------------- username | password | email | etc .... -------------------------------------------- Person 1 xxxxxx x@x.com person 2 yyyyyy y@y.com Friendship columns: --------------------------------------- username | friend | status | --------------------------------------- person 1 person 2 friends person 2 person 1 friends person 1 person 3 pending I want to query the friendship table: "SELECT friend FROM friendship WHERE username ='$_SESSION['myusername'];' AND status='friends' " (so its basically getting the user names of anyone who is the logged in users friend) And then use the returned user names to select their data from the members table. Any help much appreciated! ^.^ Hello im receiving the error code, Quote Parse error: syntax error, unexpected ';'on line 58 Code: [Select] <?php mysql_connect("","business",""); mysql_select_db("business") or die("Unable to select database"); $result = mysql_query("SELECT subtype FROM business WHERE type ='restaurant' ORDER BY name"); $number_of_results = mysql_num_rows($result); $results_counter = 0; if ($number_of_results != 0) {while ($array = mysql_fetch_array($result);) //THIS IS LINE 58 IN MY CODE $results_counter++; if ($results_counter >= $number_of_results); ?> Firstly do you know why I would get this error? and secondly how do i call my results. I basically want to return my results and then later on format them into lists. I would also like each result to have a different variable name. eg. result1 = $result1 result 2 = $result2 result3 = $result3 etc. any guidance much appreciated. Im a bit lost. I have a search form that has a drop down Code: [Select] <select name="radius" id="radius"> <option value="5">5 mi.</option> <option value="10">10 mi.</option> <option value="15">15 mi.</option> <option value="20">20 mi.</option> <option value="50">50 mi.</option> <option value="100">100 mi.</option> </select> I'm trying to limit the results in a foreach loop within what was selected. Meaning, if someone selects 10, results within 10 miles will show The foreach is Code: [Select] foreach ($stores as $k=>$v) { $output = "<h3 style='margin:0;padding:0'><b>".$storeinfo[$k]['MktName']."</b><br>(approx ".$v." miles)</h3>"; $output .= "<p style='margin:0 0 10px 0;padding:0'>".$storeinfo[$k]['LocAddSt']."<br>"; $output .= $storeinfo[$k]['LocAddCity'].", ".$storeinfo[$k]['LocAddState']." ".$storeinfo[$k]['zipcode']."</p>"; print_r($output); } $v being the distance. So I need to show only the results of $v that are less than $r. How would I go about doing this? Right now, $v displays numbers like 5.04, 173.9 and so forth. Can anybody help me out? Thanks in advance. I would like to create variables based on data stored in a database using the text in the variable. This is so that users using my script can simply add custom settings to the database and automatically use them. Example as follows: Table Structu id, name, value, group The name would become the variable name while the value would become the value of that name. Example row: 1, site_title, testing this out, site_settings Result: $site_title = "testing this out"; I know I will need to use a while() to pull the data but I don't know how to get php to automatically create a variable with the right name/data combo... Any ideas out help. $username = $_POST['uid']; $email = $_POST['mail']; $password = $_POST['pwd']; $passwordRepeat = $_POST['pwd-repeat']; $date = $_POST['date2']; $stream = $_POST['relationship']; $sql1 = "INSERT INTO users (uidUsers, emailUsers, pwdUsers, relationship) VALUES (?, ?, ?, ?);"; $sql2 = "INSERT INTO Family1 (username, application_filed, relationship) VALUES (?, ?, ?);"; $sql3 = "INSERT INTO Family2 (username, application_filed, relationship) VALUES (?, ?, ?);"; mysqli_query($sql1, $conn); mysqli_query($sql2, $conn); mysqli_query($sql3, $conn); $stmt = mysqli_stmt_init($conn); if (!mysqli_stmt_prepare($stmt, $sql2)) { header("Location: ../signup.php?error=sqlerror"); exit(); } else { mysqli_stmt_bind_param($stmt, "sss", $username, $date, $stream); $result = mysqli_stmt_get_result($stmt); if ($row = mysqli_fetch_assoc($result)) ($username==$_SESSION['uid'] and $stream =='nursing'); mysqli_stmt_execute($stmt); } if (!mysqli_stmt_prepare($stmt, $sql3)) { header("Location: ../signup.php?error=sqlerror"); exit(); } else { mysqli_stmt_bind_param($stmt, "sss", $username, $date, $stream); $result = mysqli_stmt_get_result($stmt); if ($row = mysqli_fetch_assoc($result)) ($username==$_SESSION['uid'] and $stream =='doctoral'); mysqli_stmt_execute($stmt); } if (!mysqli_stmt_prepare($stmt, $sql1)) { header("Location: ../signup.php?error=sqlerror"); exit(); } if (!mysqli_stmt_prepare($stmt, $sql1)) { header("Location: ../signup.php?error=sqlerror"); exit(); } else { $hashedPwd = password_hash($password, PASSWORD_DEFAULT); mysqli_stmt_bind_param($stmt, "ssss", $username, $email, $hashedPwd, $stream); mysqli_stmt_execute($stmt); header("Location: ../signup.php?signup=success"); exit(); I was wondering if someone could point me in the right direction. I have this code. They idea I had behind it is to insert values into different tables depending on variables being passed. So when user fills out a form and selects $stream="nursing" I want results to go to table 'users' and 'Family1', but not 'Family2' table. and if user selects $stream='doctoral' results should go to table 'users' and 'Family2', and not go to 'Family1' But with my query I get results go to both table and also users table. And there is no restriction to what users selects, variable $stream being passed no matter what it is. Is this the wrong way to go here? Did I completely mess up the logic? Not sure why this isnt working. Code: [Select] <?php session_start(); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script> <script type="text/javascript">bkLib.onDomLoaded(nicEditors.allTextAreas);</script> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <LINK REL=StyleSheet HREF="inc/dyn_style.css" TYPE="text/css" MEDIA=screen /> <?php ?> <?php include('logic.inc'); mysqlConnect(); ?> <script type="text/javascript" src="bbeditor/ed.js"></script> <link rel="stylesheet" type="text/css" href="dyn_style.css" /> <title> Social </title> <script type="text/javascript"> function changeTitle(title) { document.title = title; } </script> </head> <body> <?php $inc = 'new_story.php'; $view = 'Newest '; $by = 'added'; $where = " "; $where2 = " "; $order = "ASC"; $gen = "All"; $rat = 'All'; $blerg = ""; $sort = 'newest'; //---------------------------------------------------------------------- if(isset($_GET['sub'])) { $sort = $_GET['sort']; switch($sort) { case "Most Popular"; $by = 'views'; $view = 'Most Popular '; $order = 'DESC'; break; case "Most Reviewed"; $view= 'Most Reviewed '; $by = 'reviews'; $order = 'DESC'; break; case "Newest"; $by = 'added'; $view = 'Newest'; $order = 'ASC'; break; } $genre = mysql_real_escape_string($_GET['cat']); $rating = mysql_real_escape_string($_GET['rat']); if($gen == 'All') { $where = " "; $blerg = ""; } else { $where = "WHERE cat='$gen'"; } if ($rat == "All") { $where2 = ' '; $blerg = 'AND'; } else { $where2 = $blerg ." rating = '$rat' "; } } //---------------------------------------------------------------------- ?> <?php serch(); ?> <form action="story.php" method="get"> <label id='inline'> Order By: </label> <select name='sort'> <option selected='yes' label='Currently Selected' > <?php echo $view; ?> </option> <option> Newest </option> <option> Most Popular</option> <option> Most Reviewed </option> </select> <input type='hidden' value='spec_view' name='p' /> <label id='inline'> Genre/Catagory: </label> <select name='gen'> <option selected='yes' label = 'Selected Genre - <?php echo $gen; ?>'> <?php echo $gen; ?> </option> <option> All </option> <option> Fantasy </option> <option> Adventure </option> <option> Science Fiction</option> <option> Drama</option> <option> Fable </option> <option> Horror</option> <option> Humor</option> <option> Realistic Fiction </option> <option> Tall Tale</option> <option> Mystery </option> <option> Mythology </option> <option> Poetry </option> <option> Shorty Story </option> <option> Romance </option> </select> <label id='inline'> Rating: </label> <select name='rat'> <option selected='yes' label = "Selected Genre - <?php echo $rat; ?>"> <?php echo $gen; ?> </option> <option> All </option> <option> C </option> <option> C13 </option> <option> YA </option> <option> A </option> </select> <input type='submit' value='Go!' name = 'go' /> </form> <?php $query = " SELECT * FROM story_info ORDER BY $by $order $where $where2 "; echo $query; $select = mysql_query($query) or die(mysql_error()); while($rows = mysql_fetch_assoc($select)) { $viewsdb = $rows['views']; $titledb = $rows['title']; $userdb = $rows['user']; $catdb = $rows['cat']; $ratdb = $rows['rating']; $id_db = $rows['story_id']; $sumdb = shorten($rows['sum']); echo "<h3><a href='?p=page&id=$id_db'> $titledb </a> </h3>"; echo "<div id='fun_info'>"; echo "$sumdb <br />"; echo "By <a href='?p=profile&user=$userdb'> $userdb </a> <br /> "; echo "$viewsdb Views | Rated: $ratdb | Catagory: <a href='?p=cat_view&gen=$catdb'> $catdb </a> </div>"; } ?> </div> </body> </html> does anyone know how to decode this XML variable value into string values? I also need to know the oposite way: creating variable values into xml. I've tried several code examples but they did filter the requested data. Code: [Select] $xml='<?xml version="1.0" encoding="utf-8"?> <elements> <text identifier="ed9cdd4c-ae8b-4ecb-bca7-e12a5153bc02"> <value/> </text> <textarea identifier="a77f06fc-1561-453c-a429-8dd05cdc29f5"> <value><![CDATA[<p style="text-align: justify;">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>]]></value> </textarea> <textarea identifier="1a85a7a6-2aba-4480-925b-6b97d311ee6c"> <value><![CDATA[<p style="text-align: justify;">Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p>]]></value> </textarea> <image identifier="ffcc1c50-8dbd-4115-b463-b43bdcd44a57"> <file><![CDATA[images/stories/red/cars/autobedrijf.png]]></file> <title/> <link/> <target/> <rel/> <lightbox_image/> <width><![CDATA[250]]></width> <height><![CDATA[187]]></height> </image> <text identifier="4339a108-f907-4661-9aab-d6f3f00e736e"> <value><![CDATA[Kramer 5]]></value> </text> <text identifier="ea0666d7-51e3-4e52-8617-25e3ad61f8b8"> <value><![CDATA[6000 RS]]></value> </text> <text identifier="90a18889-884b-4d53-a302-4e6e4595efa0"> <value><![CDATA[Eindhoven]]></value> </text> <text identifier="410d72e0-29b3-4a92-b7d7-f01e828b1586"> <value><![CDATA[APK Pick up and return]]></value> </text> <text identifier="45b86f23-e656-4a81-bb8f-84e5ea76f71f"> <value><![CDATA[15% korting op grote beurt]]></value> </text> <text identifier="3dbbe1c6-15d6-4375-9f2f-f0e7287e29f3"> <value><![CDATA[Gratis opslag zomerbanden]]></value> </text> <text identifier="2e878db0-605d-4d58-9806-8e75bced67a4"> <value><![CDATA[Gratis abonnement of grote beurt]]></value> </text> <text identifier="94e3e08f-e008-487b-9cbd-25d108a9705e"> <value/> </text> <text identifier="73e74b73-f509-4de7-91cf-e919d14bdb0b"> <value/> </text> <text identifier="b870164b-fe78-45b0-b840-8ebceb9b9cb6"> <value><![CDATA[040 123 45 67]]></value> </text> <text identifier="8a91aab2-7862-4a04-bd28-07f1ff4acce5"> <value/> </text> <email identifier="3f15b5e4-0dea-4114-a870-1106b85248de"> <value/> <text/> <subject/> <body/> </email> <link identifier="0b3d983e-b2fa-4728-afa0-a0b640fa34dc"> <value/> <text/> <target/> <custom_title/> <rel/> </link> <relateditems identifier="7056f1d2-5253-40b6-8efd-d289b10a8c69"/> <rating identifier="cf6dd846-5774-47aa-8ca7-c1623c06e130"> <votes><![CDATA[1]]></votes> <value><![CDATA[1.0000]]></value> </rating> <googlemaps identifier="160bd40a-3e0e-48de-b6cd-56cdcc9db892"> <location><![CDATA[50.895711,5.955427]]></location> </googlemaps> </elements>'; Hi. I have some code which needs to return a single variable from the function and stored as a variable within this page, so it can be echoed later on in the page. I couldn't get it to return as a variable, so i used "return compact();" to return the variable and "extract (myFunction());" to extract it to variables. However, when I turned on php's display errors and error reporting function, I got an error message saying "Warning: extract() [function.extract]: First argument should be an array in /my/web/site/index.php on line 6" (which is where my extract function is). This works fine with passing more than one variables through, is there another way pass one variable from a function to be stored as a variable on the page which called the function? Here is the function: Code: [Select] <?php //This is a list of numeric error codes against their text. this will return the error code as the variable $issue function checkLoginIssue() { //If there is an error code if (isset($_GET["issue"])) { //cycle through the list until the code is reached, return the text and break the switch switch ($_GET["issue"]) { case "1": $issue = '<p class="warning">Please log in to view this page</p>'; break; case "2": $issue = '<p class="warning">Wrong Username or Password</p>'; break; case "3": $issue = '<p class="warning">No user found with those details</p>'; break; } //return the variable in an array with a single value return compact('issue'); } } ?> And here is the code which calls the function: Code: [Select] <?php extract(checkLoginIssue()); ?> I am testing live and the data is downloading to the database but when it goes to the next page it gets this message. Warning: Wrong parameter count for mysql_result() in /home/ebermy5/public_html/html/login.php on line 25 Could not execute query THIS IS MY CODING ANY IDEAS WHERE I AM GOING WRONG. YES I HAVE THE OPEN AND CLOSE PHP? if (@$_SESSION['auth'] != "yes") @include('Connections/connect_to_mysql.php'); $query = "SELECT firstName, lastName FROM `Members` WHERE email='{$_SESSION['id']}'"; $result = mysql_result($query) or die("Could not execute query"); echo "<html> <head><title>New Member Welcome</title></head> <body> <h2 style='margin-top: .7in; text-align: center'> Welcome $firstName </h2>\n"; hi all, Okay, after successfully getting a form to input data to a MySQL database, I'm now trying to get the data back out by searching. Search form code: Code: [Select] <form name="search" method="post" action="process_search.php"> Seach for: <input type="text" name="find" /> in <select name="columns"> <option value="">Please choose one:</option> <option value="status">Status</option> <option value="date">Date</option> <option value="species">Species</option> <option value="breed">Breed</option> <option value="sex">Sex</option> <option value="primary_colour">Primary Colour</option> <option value="colour">Colour</option> <option value="distinctive_traits">Distinctive Traits</option> <option value="fur_length">Fur Length</option> <option value="age">Age</option> <option value="desexed">Desexed</option> <option value="microchipped">Microchipped</option> <option value="suburb">Suburb</option> <option value="pound_area">Pound Area</option> <option value="contact">Contact</option> <option value="link">Link</option> </Select> <input type="hidden" name="searching" value="yes" /> <input type="submit" name="search" value="Search" /> </form> All good there! Form displays how I want it to, and submits correctly. The bit I'm struggling with is the process_search.php side of things. This is what I have (note that i'm trying to get the results into a formatted table and I'd like more results if the match is in more than one column): Code: [Select] <? //Here we display stuff if they have submitted the form if ($searching =="yes") { echo "<h2>Results</h2><p>"; //If they stuffed up and didn't search for anything, we show them this if ($find == "") { echo "<p>Oh, Bianca, you need to enter SOMETHING to search!"; exit; } //If everything is all good, we connect to the database mysql_connect("localhost", "******", "******") or die(mysql_error()); mysql_select_db("******") or die(mysql_error()); //Let's not forget the register globals off crap $status = $_POST['status']; $date = $_POST['date']; $species = $_POST['species']; $breed = $_POST['breed']; $sex = $_POST['sex']; $primary_colour = $_POST['primary_colour']; $colour = $_POST['colour']; $distinctive_traits = $_POST['distinctive_traits']; $fur_length = $_POST['fur_length']; $age = $_POST['age']; $desexed = $_POST['desexed']; $microchipped = $_POST['microchipped']; $suburb = $_POST['suburb']; $pound_area = $_POST['pound_area']; $contact = $_POST['contact']; $link = $_POST['link']; $columns = $_POST['columns']; // We perform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Now we search for our search term, in the field the user specified $data = mysql_query("SELECT * FROM animal_info WHERE upper($columns) LIKE'%$find%'"); //And we display the results where($result = mysql_fetch_array( $data )) { echo "<tr>"; echo "<td>".$row['status']."</td>"; echo "<td>".$row['date']."</td>"; echo "<td>".$row['species']."</td>"; echo "<td>".$row['breed']."</td>"; echo "<td>".$row['sex']."</td>"; echo "<td>".$row['primary_colour']."</td>"; echo "<td>".$row['colour']."</td>"; echo "<td>".$row['distinctive_traits']."</td>"; echo "<td>".$row['fur_length']."</td>"; echo "<td>".$row['age']."</td>"; echo "<td>".$row['desexed']."</td>"; echo "<td>".$row['microchipped']."</td>"; echo "<td>".$row['suburb']."</td>"; echo "<td>".$row['pound_area']."</td>"; echo "<td>".$row['contact']."</td>"; echo "<td>".$row['link']."</td>"; echo "</tr>"; } else { echo "ERROR: ".mysql_error(); } //This counts the number or results - and if there wasn't any it gives them a little message explaining that $anymatches=mysql_num_rows($data); if ($anymatches == 0) { echo "Nope, couldn't find anything here! Maybe refine your search criteria?<br><br>"; } //And we remind them what they searched for echo "<b>Searched For:</b> " .$find; } ?> Trouble with this is that I'm not getting any errors OR results! ANY help would be appreciated HUGELY! Cheers, Dave I have a page where I want a success and a fail response. It's a contact page so, if they fill in all that's required, and send, a success "message" will pop up but if they send but for some reason, it fails, to display a fail "message". What it does right now is the fail and success are constantly visible regardless. So how do I make it display the corresponding message accordingly? *Also how am I to make the text within the boxes invisible ? But that's lower priority Hi, I need to create a secure API at work so that 2 systems can interact with each other and request data (json format). I need to use an API key for this but don't want to use an API key stored in a database, what is the best way to go about this? I would like to use some sort of encryption algorithm and a white list of a few values to validate against once decrypted, is this safe and are there any algorithms I can use to generate my keys and white list? I have this array: Code: [Select] Array ( [jan] => 2 [feb] => 1 [mar] => 2 [apr] => 1 ) ..and I want to return: Code: [Select] Array ('jan', 'mar') As in, find the 2 elements with the highest count and put them in an array. What is the simplest way to achieve this? Hello. I want to make a web-based rpg with mysql and php but need alot of help, I tryed once and failed. Please msn me: cginbarrhaven@hotmail.com I need LOTS of help. Im stuck! Zeroth This topic has been moved to Ajax Help. http://www.phpfreaks.com/forums/index.php?topic=359538.0 |