PHP - Parsing Data From External Page Then Searching For An Entry
Hello,
I've tried to get a dynamic table from an external page, and searching for entries in it, so i used a dynamic XLS file using php excel reader. I only exported the file, but i couldn't search for data.
Can i get some help please ?
Similar TutorialsHey guys, im new around here, and i have just recently started teaching myself PHP, by looks of this site i seem very experienced but im eager to learn I seem to get an error with this code. The point of this code is to look into my database and pull out all entries with the first name _____ (whatever the user inputs) Error: Warning: mysql_fetch_array() expects parameter 1 to be resource, null given in C:\xampp\htdocs\searchans.php on line 12 Code: Filename:search.php Code: [Select] <html> <form action='searchans.php' method='POST'> First Name: <input type='text' name='firstname'><br> <input type='submit' value='Search'> </form> </html>Code: Filename:searchans.php Code: [Select] <?php $firstname = $_POST['firstname']; $con = mysql_connect("localhost","peter","abc123"); if (!$con) { die('Could not connect: ' . mysql_error()); } $query = mysql_query("SELECT * FROM Persons WHERE FirstName='$firstname'"); while($row = mysql_fetch_array($result)) { echo $row['FirstName'] . " " . $row['LastName'] . " " . $row['Age']; echo "<br />"; } ?> Hi All .... I am new to php and i am droning over here ... We are starting a new online store and I am having a huge problem with my music API. What happens is that the api does a search ...I can vouch for that because I have a mailer that sends me a failed list ...@ this point everything cannot be found. My Dvd's working with the IMDB Api works perfectly and all the info gets stored to my MySql DB. This is my code for the music function GetMusicData($album, $artist, $id) { global $db; $artist = str_replace(" ", "+", $artist); $artist = strtolower($artist); $album = str_replace(" ", "+", $album); $url='http://ws.audioscrobbler.com/2.0/?method=album.getinfo&api_key=801bf08fc2c46659ad7878778edb72b3&artist='.$artist.'&album='.$album.'&autocorrect=1' ; $ch = curl_init ($url); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); $dt=curl_exec($ch); curl_close ($ch); $data = new SimpleXmlElement($dt, LIBXML_NOCDATA); $tracklist = NULL; $x = (array)$data; Any help would be much appreciated as I can't see why I am not able to get any information. I have just over 9000 entries in my DB of well known and not so well known artists but I can't find any information. Need help in achieving a data entry grid. I have two tables am_user (idam_user, name) and am_activity (idam_act, act) with the data Data for am_user is 1, John 2, Mary 3, Kate Data for am_activity is 1, Cooking 2, Cleaning 3, Painting I have a third table that stores the role played by each user for the activities. am_role (idam_role, role) 1, Manage 2, Observe 3, Documents I want my User table to be my header, Activity table to my 1st column and Role table to populate the data grid John Mary Kate Cooking Manage Document Observe Cleaning Document null Manage Painting Observe Document Manage By putting two while loops I am able to generate the header and 1st column but I need help in populating the grid in between. Also I want my data entry area (rows and column besides header and 1st column) to have lookup where they can select values from the am_role table. So, John can "Manage" "Painting" tomorrow if he wants to The two while loops are Code: [Select] $query = "select idam_user, Name "; $query .= " from am_user "; $result = mysql_query($query) or die(mysql_error()); // display data in table echo "<center>"; echo "<table>"; echo "<tr>"; echo "<th></th>"; // loop through results of database query, displaying them in the table while($row = mysql_fetch_array( $result )) { // echo out the contents of each row into a table echo '<th>' . $row['name'] . ' '; echo "</th>"; } echo "</tr>"; $query = "select idam_act, act "; $query .= " from am_activity "; $result = mysql_query($query) or die(mysql_error()); // display data in table // loop through results of database query, displaying them in the table while($row = mysql_fetch_array( $result )) { // echo out the contents of each row into a table echo '<tr>'; echo '<td>' . $row['act'] . '</td>'; echo '</tr>'; } // close table> echo "</table>"; echo "</center>"; Please advise if this thought is realistic and how can I achieve it. Thanks in anticipation. Dear All, I am developing a website www.computationalphotography.in on which I need to register new users. I have designed an HTML form for this purpose, but will need help with writing the code for checking and validating the data in the respective fields. The code for my web form is below and the address of the website is www.computationalphotography.in/registration.php: Code: [Select] <html> <head> <title> Photography Experiment Registration </title> </head> <body> <h1> Questionnaire </h1> <h3> We would like to know about your background and interests in photography. For each multiple-choice question, please circle all answers that apply.</h3> <form method="post" action="registration.php"> Name <input name="name" type="text"> <br> <br> <input name="email" type="text"> <br> <br> 1.) Roughly How many pictures do you take each year? <br> <br> <input name="radios" type="radio" value="a"> a) a few: <10 in a year <br> <input name="radios" type="radio" value="b"> b) many: probably 100's a photos a year <br> <input name="radios" type="radio" value="c"> c) a lot: probably 1000's of photos a year <br> <br> 2.) Do you share your pictures with anyone? <br> <input name="radios" type="radio" value="a"> a) No <br> <input name="radios" type="radio" value="b"> b) Yes, but only with friends or family <br> <input name="radios" type="radio" value="c"> c) Yes, I share with friends or family and also post on public sites such as Flickr, Picasaweb, or Snapfish for anyone to see. <br> <input name="radios" type="radio" value="d"> d) Yes, I share frequently and I have also published my photos in books or magazines, or exhibitde my photos in shows. <br> <br> 3.) How much training in photography have you had? <br> <input name="radios" type="radio" value="a"> a) None <br> <input name="radios" type="radio" value="b"> b) Some, but it's self-taught from books or websites <br> <input name="radios" type="radio" value="c"> c) Quite a bit: I have taken courses in photography <br> <input name="radios" type="radio" value="d"> d) A lot:I have completed a degreee or certificate in the subject <br> <br> 4.) How do you describe yourself as a photographer? <br> <input name="radios" type="radio" value="a"> a) A novice:someone who takes a few pictures occasionally <br> <input name="radios" type="radio" value="b"> b) An amateur:someone who takes many photos, but doesn't usually share them <br> <input name="radios" type="radio" value="c"> c) An enthusiast:someone who loves to take pictures, possibly shows them with oters on public sites, or who might own a DSLR, or frequently uses a camera in other than "automatic mode" <br> <input name="radios" type="radio" value="d"> d) An expert:skilled photographer who has published their work, or exhibited their work in shows, or has been paid for their work <br> <br> 5.) Do you have artistic training or exposure? <br> <input name="radios" type="radio" value="a"> a) No <br> <input name="radios" type="radio" value="b"> b) I visit museums or art galleries <br> c) I have studied art: please describe <br> <textarea name="data5c" cols="50" rows="5"> </textarea> <br> d) I am a practicing artist: please describe <br> <textarea name="data5d" cols="50" rows="5"> </textarea> <br> <br> 6.) Some optional information, if you don't mind. We respect your privacy. <br> <br> Age <br> <textarea name="6a" cols="1" rows="1"> </textarea> <br> <br> Gender <br> <input name="radios" type="radio" value="a"> a) Male <br> <input name="radios" type="radio" value="b"> b) Female <br> <br> Languages Spoken <br> <textarea name="6b" cols="25" rows="2"> </textarea> <br> <br> Languages Read <br> <textarea name="6c" cols="25" rows="2"> </textarea> <br> <br> <br> <input type="submit" value="Send"> <input type="reset" value"Reset"> </form> </body> </html> Kindly help me out with this issue. Thank you for your help in this regard. Can anyone point out what's wrong with my feedback.php? It used to work fine and I don't think I did anything but it stopped working - i.e. I had it on a site which I never looked at and when I did look at it I noticed the rubbish written to the database had inexplicably stopped being written there some months ago..... since then I've tried to clean it up and use it elsewhere ( I'm a baby at php and most else) but I can't get it to go right. In this attempt it was giving me the dreaded 'headers already written..' error and I (after googling) took out all the blank space I could and extra comments and what not and stuck in some debugging prints for me and now I get no errors but I get nothing written to the database and no email sent to me. If anyone cares to look at it to help me out, here it is, warts and all, with just the names changed to protect the innocent. <? // mail it $mailto = 'med@yahoo.com' ; $subject = "Ploverpark Feedback Form" ; $formurl = "feedback.html" ; $errorurl = "error.html" ; $thankyouurl = "thankyou.html" ; $uself = 0; $headersep = (!isset( $uself ) || ($uself == 0)) ? "\r\n" : "\n" ; $username = $_POST['username'] ; $firstname = $_POST['firstname'] ; $email = $_POST['email'] ; $comments = $_POST['comments'] ; $secondname = $_POST['secondname'] ; $country = $_POST['country'] ; $phone = $_POST['phone'] ; // do write to database now--------------------------- $link = mysql_connect("mydb.com", "my_pkguest", "password") or die("Could not connect : " . mysql_error()); print "Connected successfully<p>"; $DB = "my_pkguest"; $table = "clients"; mysql_select_db($DB) or die ("Database $DB not select.." . mysql_error()); print "Successfully select the Database: $DB "; $query = "INSERT INTO $table(username,firstname,secondname,email,country,phone,comments) values('$username','$firstname','$secondname','$email','$country','$phone','$comments')"; print "Successfully inserted to table: $table "; //------------------------------------------------------ $http_referrer = getenv( "HTTP_REFERER" ); if (!isset($_POST['email'])) { header( "Location: $formurl" ); exit ; } print "Now past the if isset "; //if (empty($name) || empty($email) || empty($comments)) { // header( "Location: $errorurl" ); // exit ; //} if ( ereg( "[\r\n]", $username ) || ereg( "[\r\n]", $email ) ) { header( "Location: $errorurl" ); exit ; } print "Now past the if ereg "; if (get_magic_quotes_gpc()) { $comments = stripslashes( $comments ); } $messageproper = "This message was sent from:\n" . "$http_referrer\n" . "------------------------------------------------------------\n" . "UserName of sender: $username\n" . "Firstname of sender: $firstname\n" . "Secondname of sender : $secondname\n" . "Country of sender : $country\n" . "Phone number of sender: $phone\n" . "Email of sender: $email\n" . "------------------------- COMMENTS -------------------------\n\n" . $comments . "\n\n------------------------------------------------------------\n" ; print "Now past the messageproper "; mail($mailto, $subject, $messageproper, "From: \"$username\" <$email>" . $headersep . "Reply-To: \"$username\" <$email>" . $headersep . "X-Mailer: chfeedback.php 2.07" ); print "Now past the mail"; //header( "Location: $thankyouurl" ); // exit ; ?> Hello all. I am finishing up a paypal IPN php script and was wondering how I can take some data and cut some of it off before I enter it into the mysql database? Heres what I have. $payment_date = HH:MM:SS DD Mmm YY, YYYY PST This comes from paypal. I want to in my code take that and automatically cut off the HH:MM:SS part. So my question is, how can I take a known piece of data and automatically trim the first 9 spots off of it? Something like: $payment_date = HH:MM:SS DD Mmm YY, YYYY PST Minus 1 thru 9 of $payment_date = $result $payment_date2 = $result Any help? Thanks! Hi there everyone... Hi,
I have a string that looks like this:
{
"cmd": "VarReturn",
"name": "temperature",
"result": 947,
"coreInfo": {
"last_app": "",
"last_heard": "2014-07-14T11:46:17.865Z",
"connected": true,
"deviceID": "234y8172390dfsa"
}
}
which I have fetched from a web page using file_get_contents();
How do I put the data into variables? Either a variable for each piece of data eg $cmd = "VarReturn", $name="temperature" or into an array?
At the moment I'm doing it the very messy way of using strpos() to look for each section, but I'm fairly sure there's a much easier way (using regular expressions?) but I'm a bit stuck on where to start.
Any help would be much appreciated.
Hi... I am working to parse an opf file. I can pull the dc children but am having problems getting it to pull other information from the file. Is there a way to do this? What I am currently doing: $package = simplexml_load_file("$url"); echo $package->metadata->children('dc', true)->creator."<br>"; echo $package->metadata->children('dc', true)->title."<br>"; echo $package->metadata->children('dc', true)->description."<br>"; Is there a way to parse the meta content by name? File structu <?xml version='1.0' encoding='utf-8'?> <package xmlns="http://www.idpf.org/2007/opf" unique-identifier="uuid_id" version="2.0"> <metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf"> <dc:title>The Beginning of the End</dc:title> <dc:creator opf:file-as="Cassidy, Amanda" opf:role="aut">Amanda Cassidy</dc:creator> <dc:description>Working with young children can be a very rewarding job... and extremely frustrating at the...</dc:description> <meta content="Preschool Teachers Anonymous" name="library:series"/> <meta content="1" name="library:series_index"/> </metadata> </package>
Newbie here, I am actually a math teacher working on creating a simulated store front for my students where they keep up with inventory, budgeting etc. Everyday my students will have to look at how much product is in stock, how much product was sold, and then input how much should be ordered for the next day. I am working on an answer key that will be used to validate students input but the 'quantity' and 'sold' fields will be relative to the most recent post. Right now the code below pulls all the rows under 'quantity', but I need it to only pull the most recent post. I have done my best to search the forum and try to find how to do this, but admittedly I am not even really sure what to be searching for. Any help would be great. Code: [Select] <?php $con = mysql_connect("localhost","user","pass"); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db("myDatabase", $con); $result = mysql_query("SELECT * FROM myTable"); while($row = mysql_fetch_array($result)) { $quantity = $row['quantity']; $sold = $row['numbersold']; $needed = $row['remaining']; echo $needed-($quantity-$sold); } mysql_close($con); ?> I think what I'd like to do is very simple, but I just can't figure out how to accomplish the task. Fair warning -- I'm pretty new to PHP and any help is appreciated. I have a form that takes in multiple fields of data and stores it in a mysql database. I'm trying to output the data to another page on my website and I'm able to do that, but I'm really looking to output it in a way that's easily formatted using CSS. This is on a wordpress site and I'm using the following code to output my data: Code: [Select] <?php $result = $wpdb->get_results ("SELECT field_val FROM wp_cformsdata WHERE field_name <> 'page' OR 'Fieldset1'", OBJECT); foreach ($result as $teaminfo) { echo $teaminfo->field_val . "<br/>"; } ?> Obviously, this just outputs the data with a <br> after each field value. I'd like to see if there's a way to individually echo each field, such as "echo $teaminfo->name;" or "echo $teaminfo->address;" so that I can wrap each echo within a CSS class. Alternatively, would there be a way to echo the field_val wrapped around <span class="field_name"></span> ? This would also suit my needs, but I'm not sure how to accomplish it. Also, unfortunately I don't have remote access to mysql with my hosting company, but I've included the output from myphpadmin when I run describe wp_cformsdata; : Thank you in advance for your help. good day dear phpfreaks.
I am new to PHP's SimpleXML. i want to work with SimpleXML on OSM-files. The original version of this question was derived from he OSM Data parsing to get the nodes with child https://stackoverflow.com/questions/16129184/osm-data-parsing-to-get-the-nodes-with-child
I am thankful that hakre offered a great example in the comments that makes a overwhelming goal: how to get more out of it: I want to filter the data to get the nodes with special category. Here is sample of the OSM data I want to get the whole schools within an area. The first script runs well - but now I want to refine the search and add more tags. Finally I want to store all into MySQL. So we need to make some XML parsing with PHP:
The following is a little OSM Overp
Quote
since i am learning - i break down the code into pieces...For my question, the second part is more interesting here. That is querying the XML data we have already. Again - as mentioned above: This is most easily done with xpath, the used PHP XML library is based on libxml which supports XPath 1.0 which covers the various querying needs very well. The following example lists all schools and tries to obtain their names as well.
# get all school nodes with xpath //node[tag[@k = "amenity" and @v = "school"]] This line says: Give me all node elements that have a tag element inside which has the k attribute value "amenity" and the v attribute value "school". Explanation: This is the condition we have to filter out those nodes that are tagged with amenity school. Further on xpath is used again - a second time: now relative to those school nodes to see if there is a name and if so to fetch it: Therefore we use the foreach-syntax:
foreach ($schools as $index => $school)
tag[@k = "name"]/@v'
tag[@k = "name"]/@v' Because not all school nodes have a name, a default string is provided for display purposes by adding it to the (then empty) result array:
list($name) = $school->xpath('tag[@k = "name"]/@v') + ['(unnamed)'];
Query returned 907 node(s) and took 1.10735 seconds. goal: to get out even more important data - see here Key:contact - OpenStreetMap Wiki
Well - we are already extracting the name: If we want to have more data then we just have to run a few more xpath queries inside our loop for all the address keys and the website. So - additionally: we do not have to forget to look for the website key additional to contact:website. cf: https://wiki.openstreetmap.org/wiki/Key:website conclusio: well - i think that i need to extend the xpath requests within the loop where xpath is used again, now relative to those school nodes to see if there is a name and if so to fetch it:
tag[@k = "name"]/@v' i did some further tess and found out very interesting things
$query = 'node
$context = stream_context_create(['http' => [
# please do not stress this service, this example is for demonstration purposes only.
$result = simplexml_load_file($endpoint);
//
# get all school nodes with xpath
$query = 'node
$context = stream_context_create(['http' => [
$endpoint = 'http://overpass-api.de/api/interpreter';
$result = simplexml_load_file($endpoint);
me/martin/dev/php/o1.php on line 68
33 School(s) found:
so far so good : if i add some lines in the part 2 i run into errors... -see below: i want to get more data out of it: - and coded like so;
{ note - within the part 2 that works with the XML-Result.
//
# get all school nodes with xpath
contact:phone I will dig into all documents and come back later the weekend... and report all the findings well - i think that i need to extend the xpath requests within the loop where xpath is used again, now relative to those school nodes to see if there is a name and if so to fetch it:
tag[@k = "name"]/@v'
more infos I am having trouble parsing data that is separated by comas in an XLS file. The upload and parsing scripts work beautifully, but the problem I am having is the data is read in from one cell (all 5 fields for the row are in column A) I am exploding it by , but some of the cells contain comas. For example a cell might contain "jim,jones,12345678,jim@jones.com,More, Data,192.168.1.1" but the next one might be "Dave,Thomas,98765432,dave@wendys.com,something else, 255.255.255.0" The problem I am having is More, Data should be one cell. Not all position 4 will have a , so I can't just add it back because the IP address would be appended to more... Any ideas? I hope thats clear enough... So I have an interesting one for you guys this AM, I first want to make it very clear that I am not scraping code, rather I am scraping data that is needed to import into a shopping cart system for someone. I have a URL that I am trying to scrape required data off of, however it is not returning all the data that I want. I have created a function that uses preg_match_all() and regex and I am still having issues striping what I want. here is a link to my test what I am wanting to strip from http://visualrealityink.com/dev/clients/rug_src/scrapeing/Rugsource/www.vendio.com/stores/Rugsource1/item/other/tribal-wool-3x5-shiraz-persian/lid=10363581.html I am wanting to grab all this data: Quote Item Number: K-686 Style : Shiraz Province : Fars Made In : Iran Foundation : Wool Pile : 100% Wool Colors : Red, Navy Blue, Ivory, Forest Green, Light Blue, Orange Size (feet) : 4' 11" x 3' 4" Size (Centimeter) : 155 x 103 Age : 20-25 Years Old Condition : Very Good KPSI (knots per sq. inch) : 130 knots per square inch Woven : Hand Knotted Shipping and Handling : Free Shipping(For Mainland USA) Est. Retail Value : $2,700.00 Here is the code note that $url holds the link above. Code: [Select] $html = file_get_contents($url); $newlines = array("\t","\n","\r","\x20\x20","\0","\x0B"); $html = str_replace($newlinews, "", html_entity_decode($html)); preg_match_all('/<tr><td width="50%" align="right"><font color="#800000"><b>[^\s ](.*?)<\/b><\/font><\/td><td width="50%" align="left">[^\s ](.*?)<\/td><\/tr>/', $html, $matches, PREG_SET_ORDER); foreach($matches_label as $match){ $count = 0; echo $match[$count]; echo "<br>"; $count++; } echo $count; This returns the following Quote Style : Shiraz Province : Fars Foundation : Wool Colors : Red, Navy Blue, Ivory, Forest Green, Light Blue, Orange Size (feet) : 4' 11" x 3' 4" Size (Centimeter) : 155 x 103 Age : 20-25 Years Old Condition : Very Good Est. Retail Value : $2,700.00 1 it is missing: Quote Inventory Number : xxxxxxx Made In: xxxxxxxx Pile : xxxxxxxxxx KPSI(Knots Per Inch) : xxxxxxxxxx Woven : xxxxxxxxx Shopping : xxxxxxxxxxx You can see the script in action here -> http://visualrealityink.com/dev/clients/rug_src/scrapeing/scrape_tst.php Thanks in advance for all of your help I'm trying to have a running total of the number of views an image gets. My test file works perfectly every time. The actual file, image_win.php, does not and after much testing can't see what's wrong. This files STRANGENESS: the first two views count fine, with 1 added the total in the field image_visit. But every time after that 2 is added to the total in image_visit. Very bizarre. Thanks for taking a look -Allen Code: [Select] <?php ////////TEST IMAGE_WIN //////////THIS WORKS include_once "scripts/connect_to_mysql.php"; include_once "scripts/paths.php"; $art_id = 372; $QUERY="SELECT user_id FROM artWork WHERE art_id = '$art_id'"; $res = mysql_query($QUERY); $num = mysql_num_rows($res); if($num >0){ while($row = mysql_fetch_array($res)){ $owner_id = $row['user_id']; } } mysql_query("UPDATE userInfo SET image_visit = image_visit +1 WHERE user_id = '$owner_id'"); ?> <?php //////// image_win.php /////////THIS DOES NOT WORK $user_id=$_SESSION['user_id']; include_once "scripts/connect_to_mysql.php"; include_once "scripts/paths.php"; $image_link = $_GET['image_link']; $art_id = $_GET['art_id']; ?> <!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> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta name="viewport" content="width=device-width, height=device-height, target-densityDpi=device-dpi"> <title>Image Window</title> </head> <body bgcolor="#000000" leftmargin="0"> <div align="center" > <img src="slir/w640-h535/<?php echo $path.$image_link.$postCat; ?>" /> <?php $QUERY="SELECT user_id FROM artWork WHERE art_id = '$art_id'"; $res = mysql_query($QUERY); $num = mysql_num_rows($res); if($num >0){ while($row = mysql_fetch_array($res)){ $owner_id = $row['user_id']; } } mysql_query("UPDATE userInfo SET image_visit = (image_visit +1) WHERE user_id = '$owner_id' "); ?> MOD EDIT: code tags added. Hi All, I was wondering if there is any way that a PHP page can update itself when a row in a DB is added or updated? I am trying to get a feed up and running and want it to update when a row is updated/inserted. Thanks Matt Below is my code... it writes to the SQL database but does not show on the HTML page. Any advice? Code: [Select] <?php $query = mysql_query("SELECT * FROM `entries`"); $query = mysql_query("SELECT *, UNIX_TIMESTAMP(`date`) as date FROM `entries` ORDER BY `date` DESC LIMIT"); ?> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="top"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="top" class="entrysmall" align="right">Posted on: <?php echo date("d/m/y g:i a", $row['date']); ?></td> </tr> <tr> <td valign="top"> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <td valign="top" style="padding-right: 10px;"><span class="entrytitle">Name:</span></td> <td valign="bottom" width="100%"><?php echo htmlspecialchars(stripslashes($row['name'])); ?></td> </tr> <tr> <td valign="top" style="padding-right: 10px;" nowrap="nowrap"><span class="entrytitle">E-Mail:</span></td> <td valign="bottom" width="100%"><?php $email = explode('@',stripslashes($row['email'])); echo $email[0].' *at* '.$email[1]; ?></td> </tr> <td valign="top" style="padding-right: 10px;"><span class="entrytitle">Hometown:</span></td> <td valign="bottom" width="100%"><?php echo htmlspecialchars(stripslashes($row['hometown'])); ?></td> <tr> <td valign="top" style="padding: 5px 10px 0px 0px;" colspan="2"><span class="entrytitle">Message:</span></td> </tr> <tr> <td valign="top" style="padding-right: 10px;" colspan="2"><?php echo smilies(htmlspecialchars(stripslashes($row['message']))); ?></td> </tr> </table> </td> </tr> </table> </td> </tr> <tr> <td valign="top" height="10"></td> </tr> </table> Whenever I see a PHP website (and given ftp access) I often struggle to find the entry page. Most I see don't have index.php in the public_html directory - or that isn't the main entry page. Htaccess and adding Wordpress, shopping carts etc. also messes around with which file is the entry page. Is there a quick checklist of what a simpleton should do to find the entry page? E.g. (1) Check .htaccess................ etc. Hello dear friends, I've very annoying problem my website is for child drawing (draw.php) after child do drawing will click on submit (form) by sending it to another page (thanks.php) | | | | data will be submitted to database and gives message saying ( thank you for ...blah blah blah) here is the problem if he refresh the page , it will also add entry to the database so imagine if someone did many many refresh, i will get many many empty entry into database how to stop this ? here is simple code based on this problem Code: [Select] <form name="frm" method="post" action="thanks.php"> <input type="text" name="name" id="name" value=""> <input type="text" name="email" id="email" value=""> <button type="submit">Submit</button> </form> and the (thanks.php) file code *assume we have connection to db Code: [Select] $sql = "INSERT INTO $table (name, email) VALUES ('$name', '$email')"; mysql_query($sql, $conn) or die(mysql_error()); echo "Thank you kid..nice drawing"; now my problem if (thanks.php) got refreshed it will also will add empty entry to database can anyone please help me how to stop it.
Hi,
URL: http://statistik.innebandy.se/ft.aspx?scr=playercareer&fplid=182506 $data = file_get_contents($url); $dom = new domDocument; @$dom->loadHTML($data); $dom->preserveWhiteSpace = false; $tables = $dom->getElementsByTagName('table'); $rows = $tables->item(2)->getElementsByTagName('tr'); print_r($rows[0]); foreach ($rows as $row) { $cols = $row->getElementsByTagName('td'); }
This i what i want: |