PHP - Md5() Keeps Bringing Up Weird Characters When I Add A 2nd Arguement To It
I have a weird problem with an md5() function.
I am trying to write a token system, (just for my own fun really), going off an example guestbook I got help with from here. What my main aim is to allow the moderator for the guestbook to receive an email (which is working in its own context), with a link to a script page that checks into the database and when the user clicks on the link it allows the message in the guestbook to be shown. But when I try md5() the ip address of the user it works, but I thought if that same user went in and did another post, it would come up with the same checksum, causing quite bad problems to be honest. So I thought about using something like: $time = microtime(); $checksum = md5($ip,$time); But this keeps coming up with say: Quote 3RiYD Is there anyway of getting around this at all? To show a real value as I am sure this wont work, any helps greatly appreciated, Jeremy Similar TutorialsHi. I made a website to keep track of where I am in various manga. I noticed that sometimes the title I grab looks OK when rendered on the page but in the database it's weird looking
I did a for ($x=0; $x<strlen($title); $x++) loop and dumped $x, char at $ pos and ord of char: 0 = T = 84 1 = h = 104 2 = e = 101 3 = = 32 4 = D = 68 5 = e = 101 6 = m = 109 7 = o = 111 8 = n = 110 9 = = 32 10 = K = 75 11 = i = 105 12 = n = 110 13 = g = 103 14 = � = 226 15 = � = 128 16 = � = 153 17 = s = 115 18 = = 32 19 = D = 68 20 = a = 97 Is there some nifty built in function for converting that weird stuff to a regular apostrophe (and convert any other weird stuff)? I mean, I can write a filter to look for 226/128/153 and replace with ' but I'm sure there must be a proper way to handle that stuff. Thanks! I have a piece of code that outputs json as you can see from the example below it add \ / in front of urls & for ' it turns it into ' is there something i can do to correct this? Code: [Select] if (mysqli_num_rows($r) > 0) { // Available. while ($row = mysqli_fetch_array($r, MYSQLI_ASSOC)) { $results[] = array( 'blog_id' => ($row['ID']), 'post_date' => ($row['pd']), 'post_title' => ($row['post_title']), 'article_img' => ('http://www.socialnewsoffice.com/uploads/'.$row['article_img']), 'post_content' => ($row['post_content']), 'tags' => ($row['tags']), 'views' => ($row['views']), 'categorie_id' => ($row['categorie_id']), 'post_url' => ($row['post_url'])); } echo $json = Pretty_JSON(json_encode($results)); it outputs Code: [Select] [{ "blog_id":"3", "post_date":"Thu, 1 March 2012", "post_title":"Facebook's New Fan Page Learn How To Use Features", "article_img":"http:\/\/www.socialnewsoffice.com\/uploads\/17963.jpg", "post_content":"<p>This week saw the release of Facebook's latest functionality changes (Timeline for Businesses) that will shape the future of how businesses will market their campaigns, through the social media giant Facebook. A number of marketers are wondering how they will incorporate the new features in an attempt to progress and move forward with their online social media presence.<\/p>\r\n<p>Taking all the key changes in to consideration we have managed to create a guide on how to smoothly move with the times and embrace the new Facebook layout.<\/p>\r\n<p>Please read on below for helpful tips and tricks on how to excel with 'Timeline for Brands'<\/p>\r\n<h2>New Features Announced at the Facebook Marketing Conference:<\/h2>\r\n<p><strong>View and Apps:<\/strong> What was once known as Application pages has changed to 'Tabs'. These can now have customizable images linked with them and the order of them can be changed too. Below you can see from the screenshot what a customized Facebook Timeline looks like.<\/p>\r\n<p><strong>Pinning Content:<\/strong> With this new feature you can 'pin' a post to the very top of your Facebook Timeline. This is Very effective when working on a new campaign and is a great way to entice increased traffic to your tab or application page.<\/p>\r\n<p><strong>Featured 'Starred' Content:<\/strong> This feature allows you to select key content or imagery and extend it so it fits across your entire page. Therefore giving you featured content on your Facebook Timeline and making it more visible.<\/p>\r\n<p><strong>Cover Photos:<\/strong> Cover Photos are another great new feature that allow you to announce your latest campaign, welcome your following community or just simply show visitors to your timeline what you can do. There are some slight flaws with this feature though and will be addressed below.<\/p>\r\n<p><strong>Page Dimensions:<\/strong> Dimensions of application pages has now changed with the release of Facebook Timeline. If you happen to be an SML user then you have all the tools necessary to update your page on your own. If your using Involvers App Suite then those applications will be updated soon.<\/p>\r\n<p><strong>Removal of Default Landing Pages:<\/strong> The commonly used Facebook landing pages have been removed and replaced with various options to allow brands to drive content to application pages. These options allow you to use your cover photo and pinned content to attract users to your personal application pages. Despite the changes it is however still possible to link directly to application pages from ads, posts and outside of Facebook.<\/p>\r\n<h2>Getting Started with Timeline For Brand:<\/h2>\r\n<p>Firstly when accessing and logging in to your New Facebook Brand Page, you will see this admin message displayed below:<\/p>\r\n<p>When will my Page change to the latest design?<\/p>\r\n<p>To see a preview of what your new pages will look like, simply click on the green button at the top of your current pages. A second option is to wait until March 30th 2012 when all pages will be upgraded automatically.<\/p>\r\n<p>Where can I visit to learn more about how to use the new Pages?<\/p>\r\n<p><strong>There are a number of places you can visit to learn all you need to know about Pages:<\/strong><\/p>\r\n<ul>\r\n<li>To find out more about new features, download the Pages Overview guide by clicking here.<\/li>\r\n<li>If your wondering how to get started with Pages then download Facebook's full Pages Product Guide by clicking here.<\/li> \r\n<li>The Pages Learning video allows you to walk through the key features with Facebook's product experts.<\/li> \r\n<li>If you need answers to specific questions, visit Facebook's Help Centre. <\/li>\r\n<\/ul>\r\n<h2>How should I choose a cover photo for my Page?<\/h2>\r\n<p>Firstly select a unique image that represents your page. Facebook itself recommends using a photo of a popular menu item, album artwork or an image of your product being used by someone. You need to experiment with a number of different images that your audience responds positively to. \r\nFew key elements of Cover Images:\r\n<\/p>\r\n<p><strong>Each Cover image must be at least 399 pixels wide and must not contain the following:<\/strong><\/p>\r\n<ul>\r\n<li>Prices \/ Purchase information and displaying offers such as \"60% off this month\" are not permitted. Also 'Download this from our website' is not allowed.<\/li> \r\n<li>No email addresses, web addresses and any other contact information.<\/li>\r\n<li>References to clicking on or the use of Facebook interface elements such as Like or Share or any other Facebook Features.<\/li>\r\n<li>\"Tell your friends\" or \"Get it now\" or any other calls to action are not allowed in the latest version of Facebook Timeline.<\/li>\r\n<\/ul>\r\n<p>All Timeline cover imagery is public and therefore means anyone visiting your Page will be able to see exactly which image you have chosen. The photos you display must not be deceptive, false or misleading any way that infringes on third party intellectual property. You must also not encourage of incentivize other fellow users, friends or business associates to display the same cover image as yours on personal Timelines.<\/p>\r\n<p>To sum up we are extremely excited about the latest Facebook feature release this week. They constantly deliver new services that are amazing and incredibly innovative to the market place.<\/p>\r\n<p>Here at Northplanet we are commited to provide you with the latest information on the hottest online topics around, to keep you ahead in the game. We would love to hear some feedback from you on the brand new Facebook 'Timeline for Brands' release and invite you to visit our very own <a href=\"https:\/\/www.facebook.com\/northplanet\">Northplanet Facebook Timline page by clicking here.<\/a><\/p>", "tags":"facebook, new fan page", "views":"253", "categorie_id":"2", "post_url":"facebooks-new-fan-page-learn-how-to-use-features" } http://pixpresso.mycyberlove.com/ This is my test hosting for this site I'm making. Navigation and facebook login are almost done. So, the problem is that after facebook login URL is http://pixpresso.mycyberlove.com/#_=_ Why is this? Is this bad, should I and can I remove this? Hi, I've been looking at this for a couple of hours and it's killing me a little inside. I've butchered a few pieces of code from various sources together and come up with this. I understand how it's supposed to work (or i'm pretty sure i do) but the foreach statement is giving me the following error: Warning: Invalid argument supplied for foreach() /document/etc/etc on line 80 Obviously the offending statement is this one: Code: [Select] <?php // Check if button name "Submit" is active, do this if($_SERVER['REQUEST_METHOD'] == "POST") { foreach($_POST['id'] as $id) { $update="UPDATE users SET firstname='" . $_POST["firstname".$id] . "', lastname='" . $_POST["lastname".$id] . "', email='" . $_POST["email".$id] . "', password='" . $_POST["password".$id] . "', adminid='" . $_POST["adminid".$id] . "' WHERE id='" . $id . "'"; $result = mysql_query($update); echo "Updated"; } } ?> Not a clue what the problem is atm. If someone could either tell me or point me in the right direction i'd appreciate it/ Reece Hello, I hope all of you are safe with your families. Currently I am starting with PHP Coding and I am trying to do a simple query to MySQL DB using PHP but even when is able to bring the number of rows is not displaying the values in the DB. This is my code: <?php $servername = "localhost"; $database = "mydbtest"; $username = "root"; $password = "root"; // Create connection $conn = mysqli_connect($servername, $username, $password, $database); // Check connection if (!$conn) { die("Connection failed: " . mysqli_connect_error()); } //echo "Connected successfully"; $myquery = "SELECT * FROM Country"; $result = $conn->query($myquery); $numf = $result->num_rows; echo "Number of rows " . $numf . "<br>"; if($numf >0){ while($row = $result->fetch_object()){ echo "Code" . $row->countrycode . "<br>"; echo "Country" . $row->countryname . "<br>"; } }else{ echo '0 results'; } mysql_free_result($myout); mysqli_close($conn); ?> What is failing?
Thanks in advance for the assistance. Hi Having thought the PHP form was working OK, I took a break. Upon return, it's up to its old tricks. Could anyone glance over this code for blatant errors? It works when it wants and when it doesn't... Much appreciated <? $select=$_POST['select']; $name=$_POST['name']; $email=$_POST['email']; $confirmail=$_POST['confirmail']; $month=$_POST['month']; $day=$_POST['day']; $year=$_POST['year']; $leaving=$_POST['leaving']; $hour=$_POST['hour']; $minutes=$_POST['minutes']; $ampm=$_POST['ampm']; $going=$_POST['going']; $flightnumber=$_POST['flightnumber']; $pay=$_POST['pay']; $song=$_POST['song']; $comments=$_POST['comments']; $to="beepbeepyeah@kabeoke.com"; header('Location:http://www.kabeoke.com'); $message="Message Type: $select\n\nName: $name\n\nEmail: $email\n\n$confirmail\n\nDate of Journey: $month, $day, $year\n\nLeaving From: $leaving\n\nDeparture Time: $hour:$minutes $ampm\n\nGoing to: $going\n\nFlight Number: $flightnumber\n\nPayment Method: $pay\n\nSong Requests: $song\n\nComments: $comments"; if(mail($to,"Slap it - message from Kabeoke.com!",$message,"From: $email\n")) { } else { echo "There was a problem sending the mail. Please check that you filled in the form correctly."; } ?> this works Code: [Select] <form action="" method="post"> <input name="DepartureDate" type="text"> <input name="" type="submit"></form> <?php $DepartureDate=$_POST['DepartureDate']; echo $DepartureDate = stripslashes($DepartureDate); // sql inject clean $regex = "/^[a-z]+$/"; if (!preg_match($regex, $DepartureDate)){ echo 'CAPS BABY!';} else {echo 'OK!';} ?> this doesnt Code: [Select] if (!preg_match($regex, $DepartureDate)) { mail($to, $subject, $message, $headers); echo $url_success = "confirmation.php"; //echo("<meta http-equiv = refresh content=0;url=".$url_success.">"); } else { exit(); } Dear all, I updated my versions of php/MySQL and OS to Windows 7 Professional and weird "Warnings and Notices:" started popping up. E.g. Code: [Select] "Notice: Undefined index: page in C:\Server\htdocs\domain\index.php on line 25 " Code: [Select] Warning: date(): It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected 'America/New_York' for '-4.0/DST' instead in C:\Server\htdocs\domain\index.php on line 12 " I don't know what is going on. Unless I enter these following functions (error_reporting(0);, session_start() with their parameters these warnings display. Can anyone offer any advice? Any assistance is appreciated. Hey guys, how are you. I have an odd problem and I am not sure what is causing it. I recently finished my form system, with PHP validation that sends the inputted information via email. Now, everything is working fine on my end with absolutely no issues, but it is not working on any other computers, even though my computer is in no way hosting the files. Now, the issue other computers are getting is when the form is filled out it doesn't redirect to the success page, it redirects back to the form page with nothing filled out and it doesn't display the errors on the page. Any idea on what might be causing this? Again, EVERYTHING works flawlessly on my end, that being, the display of any errors, the proper redirect, everything. Thanks!!! tore the forum apart looking for a solution to this one. for some reason, this is generating an 'unexpected $end' error. this is ALL the code. in entirety. i was just messing around getting familiar with filesystem stuff. no short tags. no curly brackets. so... Code: [Select] <?php $fileHandler = fopen("someFile.txt", 'w') or die ("could not create file"); $text = <<<_END drop some text and some stuff plus this stuff some other stuff _END; fwrite($fileHandler, $text) or die ("could not write to file"); fclose($fileHandler); echo "File 'someFile.txt' written successfully"; ?> thanks people. this has be stumped. not like its complicated, eh? and as you can see, screws up the colour coding as well... but WHY!?!? WR! I have a development machine running WAMP on a win7 64 bit box. php 5.3.13
I have a server that runs Apache 2.2, php 5.3.12 MySql, etc.
I am running joomla 2.5.27 on both machines.
I require a number of php includes to many of the joomla articles (this works great via a plugin called Directphp)
After considerable time getting the site fully working on the dev machine, I ran into an unforseen problem when I uploaded to the production box.
For some unknown reason, the includes work fine on the dev machine using $DOCUMENT_ROOT to define the root (then tag the correct path and file to this)
However, on the production box, this doesn't work - but... $_SERVER['DOCUMENT_ROOT'] does.
Annoyingly, $_SERVER['DOCUMENT_ROOT'] won't work on the dev machine - and $DOCUMENT_ROOT doesn't work on the production box.
So, I can't come up with a generic method to keep both machines happy.
I've checked the php.ini files on both boxes and the register global is OFF on both.
They also seem to interperate the syntax differently in the actual include files - one box hates double quotes - the other has issues with single quotes.
This is really annoying as most of the includes are HTML snippets, coded into php.
The double/single quote problem means I would need to have two versions of the include files.
Can anyone help me with this? - serious hair pulling has started!
Okay, so basically my news-like site is supposed to print out article data saved in the database. It does that quite alright, except on the 3rd article (number 2 in SQL rows or columns. whichever it is. I have my counter subtract 1 from the start article to compensate for MySQL) My code: Code: [Select] <?php print "<div class = 'menu' align='center'>Newest Stories</div>"; if (isset($_REQUEST['mstart'])) { $start=$_REQUEST['mstart']; } else { $start=1; } if ($start) { $start=1; } $start--; $end=$start+5; $stories = mysql_query("SELECT * FROM stories ORDER BY id DESC LIMIT $start, $end") or die(mysql_error()); $num = mysql_num_rows($stories); $start++; if ($num > 0) { if ($num<$end) { $end = $end-(5-$num); } print "<b><i>Showing stories $start to $end</i></b>"; for ($count=0; $count<$num; $count++) { print "<hr>"; $story = mysql_fetch_array($stories,$count); $id = $story['id']; $headline = $story['headline']; $author = $story['author']; $desc = $story['description']; $content = $story['content']; print "COUNT: $count OF $num ($id)<br>"; print "<a href='index.php?request=story&mstart=$start&story=$id' class='headlinelink'>$headline</a><br>"; print "<div class='author'>Posted by: <a href='index.php?request=author&mstart=$start&author=$author' class='author'>$author</a>.</div>"; print "<div class='desc'>$desc</div><br>"; } } else { print "Error. No stories found. :("; } ?> Output: (The COUNT x OF y was to help me figure out what is wrong. In the () by it is the id number of the corresponding MySQL row/column. I even deleted one of the articles to see if it was a specific article error. No luck.) Quote Newest Stories Showing stories 1 to 5 ---------------- COUNT: 0 OF 5 (6) Y U NO STAY Posted by: craigory83. GRRR ---------------- COUNT: 1 OF 5 (5) h-l! Posted by: craigory83. desc ---------------- Notice: Undefined index: id in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dba\menu.php on line 37 Notice: Undefined index: headline in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dba\menu.php on line 38 Notice: Undefined index: author in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dba\menu.php on line 39 Notice: Undefined index: description in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dba\menu.php on line 40 Notice: Undefined index: content in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dba\menu.php on line 41 COUNT: 2 OF 5 () Posted by: . ---------------- COUNT: 3 OF 5 (2) This is the second story! Posted by: TDWP83. See, I fuckin told you so! Warning: mysql_fetch_array() [function.mysql-fetch-array]: The result type should be either MYSQL_NUM, MYSQL_ASSOC or MYSQL_BOTH in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\dba\menu.php on line 36 ---------------- COUNT: 4 OF 5 (1) This is the mother fucking headline! Posted by: craigory83. stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff stuff How can you prevent your browser from caching a page? I think that my news feed is being cached and is causing new posts to not be displayed even after a refresh. Eventually, the posts will show up after about 20 refreshes. I know my query is right so I didn't know if there was a way to stop page caching. I don't really know if it is a caching issue though. I'm starting to think I just have some weird bug in my code because sometimes on refresh news feed items get removed then i'll refresh again and some will get added back in then i'll refresh again and they'll all be there. Ever heard of this happening? I've got some PHP code that accesses SQL on an Amazon cloud server. Other machines running Unix and Windows can perform accesses fine using the server name (IP for Windows, label for Unix), database name (string) and a password (string). However, the same code FAILS on OSX (my Macbook Pro). SQL managers on my MBP have no problem accessing it, since I've made the proper exceptions on the AWS firewall. But PHP can't do any MS SQL reads of this database. Is there something else I don't know? Is there some other key information being exchanged that my MBP needs to send that I can't see? TIA!! I'm inserting some data from a CSV file into a database. I'm using mysql_real_escape_string to escape a string and getting some really weird output. ex. input string = Adobe CS5 output = \0\0A\0d\0o\0b\0e\0 \0C\0S\05 I plugged the string into mb_detect_encoding and it told me it was in ASCII and I did a bunch of searching to find out that \0 is a null byte. The only thing I can't figure out is how to convert it to something that won't give me that garbage when I run it through mysql_real_escape_string. I tried mb_convert_encoding($str,"ISO-8859-1","ASCII") and it didn't do anything. Anyone know something I can try?? Hey guys! Well this is actually kind of a weird problem I have been having, and not too sure why I'm getting this problem. I've tried a lot of stuff, and it doesnt seem like I've been able to find a solution. I've been trying for about a month. Anyways, I have a website created with some OOP. Well, once I write an include statement to include a file, which then includes all my classes, it messes up my font, moves my website content down, and well.. it just does weird stuff. However, once I comment the include out, the website looks normal again. so basically, I can comment out the file itself and everything is just fine. But it only happens when I include my class files. Any ideas or suggestions would be amazing! Thank you! Hi Guys/Gals, I have a search form that people search for keywords. Basically and one field and one button form. When they search for a particular string for example, "white" it's only bringing up one result, but 23 times. Here's my code: Code: [Select] <?php require("format.php"); //Get the page number for later $pagenum = $_GET['pagenum']; //Here we display stuff if they have submitted the form if ( $_GET['searching'] == 'yes' ) { //If they stuffed up and didn't search for anything, we show them this if ($_GET['find'] == "") { //Build the HTML display that will output the page when no search is entered echo "$noSearch"; } //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 $animalID = $_GET['animalID']; $status = $_GET['status']; $date = $_GET['date']; $species = $_GET['species']; $breed = $_GET['breed']; $sex = $_GET['sex']; $primary_colour = $_GET['primary_colour']; $colour = $_GET['colour']; $distinctive_traits = $_GET['distinctive_traits']; $fur_length = $_GET['fur_length']; $age = $_GET['age']; $desexed = $_GET['desexed']; $microchipped = $_GET['microchipped']; $suburb = $_GET['suburb']; $pound_area = $_GET['pound_area']; $contact = $_GET['contact']; $link = $_GET['link']; $columns = $_GET['columns']; $find = $_GET['find']; $searching = $_GET['searching']; // We perform a bit of filtering $find = strtoupper($find); $find = strip_tags($find); $find = trim ($find); //Check to see if there's a page number, if not, set it to 1 if (!(isset($pagenum))) { $pagenum = 1; } //Count the number of results based on the search term $numresultsSQL = "SELECT *, MATCH(animalID, status, date, species, breed, sex, primary_colour, colour, distinctive_traits, fur_length, age, desexed, microchipped, suburb, pound_area, contact, img_data, notes) AGAINST ('%$find%' IN BOOLEAN MODE) AS score FROM animal_info WHERE MATCH(animalID, status, date, species, breed, sex, primary_colour, colour, distinctive_traits, fur_length, age, desexed, microchipped, suburb, pound_area, contact) AGAINST('%$find%' IN BOOLEAN MODE)"; $numresults = mysql_query($numresultsSQL) or die (mysql_error()."<br><br>Encountered when atemptempting to run the following query:<br>$numresultsSQL"); $rows = mysql_num_rows($numresults); $idForPicture = "SELECT ID FROM animal_info WHERE animalID='$find'"; $idResults = mysql_query($idForPicture) or die (mysql_error()."Couldn't get an ID from the record"); //How many results should be per page? $page_rows = 1; //What is the last page number? $last = ceil($rows/$page_rows); //Make sure the page number isn't a negative number or more than the maximum page required if ($pagenum < 1) { $pagenum = 1; } elseif ($pagenum > $last) { $pagenum = $last; } //Now we search for our search term, in the field the user specified so we know how many pages to link to at the bottom $data = "SELECT *, MATCH(id, animalID, status, date, species, breed, sex, primary_colour, colour, distinctive_traits, fur_length, age, desexed, microchipped, suburb, pound_area, contact, img_data, notes) AGAINST ('%$find%' IN BOOLEAN MODE) AS score FROM animal_info WHERE MATCH(animalID, status, date, species, breed, sex, primary_colour, colour, distinctive_traits, fur_length, age, desexed, microchipped, suburb, pound_area, contact) AGAINST('%$find%' IN BOOLEAN MODE) LIMIT 0,1"; $id = $row['id']; $img_mime = $row['img_mime']; $content = $row['img_data']; $results = mysql_query($data) or die(mysql_error()); //edited here if (mysql_num_rows($results) < 1) { echo "$noResults"; } elseif(mysql_num_rows($results) > 0) { //And we display the results of the search query as long as there is some while($row = mysql_fetch_array($results)) { //Build the HTML for the results in the table echo "$resultsHTMLabove"; echo " --Page $pagenum of $last-- <p>"; echo "<br><BR>"; //Here's the table echo "<table width=\"100%\" border=\"0\" cellspacing=\"5\" cellpadding=\"2\">"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Animal ID</th>"; echo "<td>".$row['animalID']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Status</th>"; echo "<td>".$row['status']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Date</th>"; echo "<td>".$row['date']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Species</th>"; echo "<td>".$row['species']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Breed</th>"; echo "<td>".$row['breed']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Sex</th>"; echo "<td>".$row['sex']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Primary Colour</th>"; echo "<td>".$row['primary_colour']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Colour</th>"; echo "<td>".$row['colour']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Distinctive Traits</th>"; echo "<td>".$row['distinctive_traits']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Fur Length</th>"; echo "<td>".$row['fur_length']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Age</th>"; echo "<td>".$row['age']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Desexed?</th>"; echo "<td>".$row['desexed']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Microchipped?</th>"; echo "<td>".$row['microchipped']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Suburb</th>"; echo "<td>".$row['suburb']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Pound Area</th>"; echo "<td>".$row['pound_area']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Contact</th>"; echo "<td>".$row['contact']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Link</th>"; echo "<td><a href='".$row['link']."' target=_blank >Link to Facebook</a></td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Notes</th>"; echo "<td>".$row['notes']."</td>"; echo "</tr>"; echo "<tr>"; echo "<th scope=\"row\" align=\"left\">Photo</th>"; echo "<td>"; echo "<img src=\"getimage.php?id=".$row['ID']."\" width=\"200px\" height=\"150px\" />"; echo "</td>"; echo "</tr>"; echo "</table>"; echo "<BR><BR>"; //Build the navigation if ($pagenum == 1) { } else { echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=1&find=$find&columns=$columns&searching=$searching'> <<-First</a> "; echo " "; $previous = $pagenum-1; echo " <a href='{$_SERVER['PHP_SELF']}?pagenum=$previous&find=$find&columns=$columns&searching=$searching'> <-Previous</a> "; } //This does the same as above, only checking if we are on the last page, and then generating the Next and Last links if ($pagenum == $last) { } else { $next = $pagenum+1; echo " <a href='{$_GET['PHP_SELF']}?pagenum=$next&find=$find&columns=$columns&searching=$searching'>Next -></a> "; echo " "; echo " <a href='{$_GET['PHP_SELF']}?pagenum=$last&find=$find&columns=$columns&searching=$searching'>Last ->></a> "; } echo "<br><BR>"; //And we remind them what they searched for echo "<b>You searched for:</b> " .$find; echo "</div>"; //Build the footer part of the page echo "$resultsHTMLbelow"; } //If there wasn't any results, we say thanks for searching, but we couldn't find anything that was worth showing and ask them to try again if ($numresults == 0) { //Once again, build the HTML output of the page for the "No Search Results" page echo "$noResultsSearch"; } } } ?> Really confusing to say the least. Could anyone shed some light? Any help would be appreciated! Cheers, Dave So, I wrote a little function the other day to fetch an array of elements out of character-separated-data (like "value1|value2|value3", but then fetched into an array using explode()). The only thing is just that it isn't working at all[/]. Every time I run the function, and catch it as an variable to use it as an array, it simply outputs the word "media", with each character separated into one array-element. Could anybody figure out what's wrong with my code? (Aside from my style, I know it's horrible. I'm halfway learning OOP) Any help would be greatly appreciated. Code: [Select] if(!function_exists('getText')) { function getText($item) { $text = explode(" | ", $data["text"][$item]); $text = Array(0=>"")+$text; return Array(1=>$data["text"][$item]); //outputs Array(0=>"", "m", "e", "d", "i", "a") } } |