Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Query looks fine, while ordering by prime ID will work, you may run into trouble if you need to update the code to order by recently updated!
  2. $myarray = read('file.txt'); //single echo $myarray[0]; //first item //loop foreach($myarray as $items){ echo "this is a item '$items'<BR />\n"; }
  3. echo the query, check for whitespaces Check the query with a single name ie SELECT name FROM crocodylus_contig_info WHERE name IN ("0001") if that works, try SELECT name FROM crocodylus_contig_info WHERE name IN ("0001","0002") logically it looks fine so i would have to say its down do the data
  4. if SELECT * FROM Events ORDER BY timestamp DESC LIMIT 10 works why are you using SELECT * FROM Events ?
  5. I think I had this problem a few weeks ago, I was trying to break a paragraph into sentences, is that what your trying to achieve ?
  6. if you set the default to current_time/NOW() it should be fine
  7. I'm going offline so i better say 1. You would need to be == instead of = 2. it will alway return false as $mysqli->query will produce an error 3. try counting the rows instead ie if ($result->num_rows == 0) {
  8. Erm.. you may want to look at this line again! if ($result = $mysqli->query) {
  9. add a timestamp field and then ORDER BY timestamp DESC LIMIT 10
  10. And what exactly is the question and what are you stuck on ?
  11. Okay first off please use code tags (using [/b]..code...[b] or [/b]..code...[b] ) when when you post your code. if your trying to get the ID from the database record and pass that via the URL to the next page your need move the echo inside the loop ie <body> <p><img src="transconlogo12-12_jkqn" alt="Transcontinental Valuations logo." height="80" width="396" /></p> <form method="post" action="<?php echo $_SERVER ['PHP_SELF'];?>"> <?php require_once ('connvars.php'); $dbc = mysqli_connect ( db_host, db_user, db_password, db_name ) or die ( 'Error connecting to MySQL server.' ); $search_criteria = $_POST ['searchcriteria']; $query = "Select * FROM job WHERE tc_number='$search_criteria'"; $result = mysqli_query ( $dbc, $query ); while ( $row = mysqli_fetch_array ( $result ) ) { echo $row ['job_id']; echo ' ' . $row ['tc_number']; echo ' ' . $row ['prop_addr_1']; echo '<br/>'; echo "<a href='propinsp.php?job_id=".$row ['job_id']."'>click here</a>"; } mysqli_close ( $dbc ); ?> <h4><span>Locate a Property Inspection:</span></h4> <input class="searchtext" id="searchcriteria" name="searchcriteria" value="Enter TC Number" /><input class="headerSubmit" id="go" name="go" value="Go" type="submit" /> <ul id="headerNav"> <li><a href="upload.php" title="upload">Upload</a></li> <li><a href="pending.php" title="Pending">Pending</a></li> <li class="headerRight"><a href="/logout" title="Logout">Logout</a></li> </ul> </form> </body>
  12. okay, as this is in the PHP section and not the SQL one try this logic find all items in the database and store them in an array and then use arraydiff to generate a new array of unfound items try this untested script (update table and field of course) <?php $findme = array("One","Two","Three","Four"); $query = sprintf("SELECT field FROM table WHERE field in (%s)",implode(",", $findme)); $result = mysql_query($query); $found = array(); while($row = mysql_fetch_assoc($result)){ $found[] = $row['field']; } $notFound = array_diff($findme, $found); echo "<pre>";var_dump($notFound);echo "</pre>"; ?>
  13. In your last code you posted you still have echo "<a href='propinsp.php?job_id=$job_id'>click here</a>"; instead of echo '<a href="propinsp.php?job_id='. $row['job_id'] .'">click here</a>'; I am also assuming that propinsp.php is another page that you haven't posted
  14. check your not getting an SQL errors change $result=mysqli_query($dbc,$query); to $result=mysqli_query($dbc,$query) or die($query.mysql_error()); Also what do you mean by getting a blank page ? do you mean blank or no results
  15. Okay.. first of all you have a POST and a GET.. while both can be used it is often the problem, can you post more of your script so we can see the input form as well
  16. Find records with the Name MadTechie SELECT * FROM table WHERE name = 'MadTechie' Find records without the Name MadTechie SELECT * FROM table WHERE name != 'MadTechie'
  17. shouldn't echo '<a href="propinsp.php?job_id='. $job_id .'">click here</a>'; be echo '<a href="propinsp.php?job_id='. $row['job_id'] .'">click here</a>'; as i assume you mean the ID from the database
  18. I'll keep this short as i am about to go to bed, easy solution change the meaning of random to "low predictability rating due to too many factors" SOLVED! as we're on the subject of predictability (well kinda) I remember a theory that suggested if you could calculate all the forces on every atom in the universe. you could in essence play all the actions forward at a slightly fast pace thus predict the future... The problems I see with this are not only do you need everything at once but anything used to do the calculations would have changing atoms and will then need to be re-calculated which then means its atoms have change thus it needs to re-calculated etc etc etc etc
  19. No worries remove the last <tr> so change preg_match_all('%</td><td><p>(.*?)</p></td></tr><tr>%', $html, $match, PREG_PATTERN_ORDER); to preg_match_all('%</td><td><p>(.*?)</p></td></tr>%', $html, $match, PREG_PATTERN_ORDER); Translation Find </td><td><p> then (.*?) capture everything until </p></td></tr>
  20. Well the url your using doesn't have in it so, you could say it is working.. try this $html = file_get_contents("http://support.xbox.com/support/en/us/nxe/xboxstatus.aspx"); preg_match_all('%</td><td><p>(.*?)</p></td></tr><tr>%', $html, $match, PREG_PATTERN_ORDER); $match = $match[1]; foreach($match as $matches){ echo "$matches<BR />\n"; }
  21. untested but this should work $html = "HTML CODE HERE"; preg_match_all('%<td class="last"><p>(.*?)</p></td>%', $html, $match, PREG_PATTERN_ORDER); $match = $match[1]; foreach($match as $matches){ echo $matches; }
  22. You probably don't have the primary set to AUTO_INCREMENT
  23. I just tried it and it seams fine on my local machine, (are you sure its not in safe mode) also check what open_basedir is set to My text script <?php class Myspace { function login($username, $password) { $username = $_POST['user']; $password = $_POST['passwd']; $login_url = "https://secure.myspace.com/index.cfm?fuseaction=login.process"; $post_data = "ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Email_Textbox=$username&ctl00%24ctl00%24cpMain%24cpMain%24LoginBox%24Password_Textbox=$password"; $ch = curl_init($login_url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $login_url); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1); curl_setopt($ch, CURLOPT_AUTOREFERER, 1); curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10); curl_setopt($ch, CURLOPT_MAXREDIRS, 10); curl_setopt($ch, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2) "); curl_setopt($ch, CURLOPT_COOKIEJAR, "cookie.txt"); curl_setopt($ch, CURLOPT_POST, 1); curl_setopt($ch, CURLOPT_POSTFIELDS,$post_data); curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); $result = curl_exec($ch); curl_close($ch); echo $result; } } if($_POST['user'] && $_POST['passwd']) { $login = new Myspace; echo $login->login($_POST['user'],$_POST['passwd']); } else { echo "<html> <body> <form action='' method='POST'> <input type='text' name='user' /><br /> <input type='password' name='passwd' /><br /> <input type='submit' value='submit' /> </form> </form> </body> </html>"; } ?>
  24. Adding curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); should fix the problem
  25. As i have sad People can only guess what the function would do, your first step is to find the function if possible and include it if its lost then create the function, a dummy one would be fine to start with function escape_data($data){ return $data; } Then you need to workout what it should do, and apply that to the new function, ie function escape_data($data){ return mysql_real_escape_string($data); } I would like to know where you got the code from ?
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.