-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
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!
-
$myarray = read('file.txt'); //single echo $myarray[0]; //first item //loop foreach($myarray as $items){ echo "this is a item '$items'<BR />\n"; }
-
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
-
if SELECT * FROM Events ORDER BY timestamp DESC LIMIT 10 works why are you using SELECT * FROM Events ?
-
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 ?
-
if you set the default to current_time/NOW() it should be fine
-
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) {
-
Erm.. you may want to look at this line again! if ($result = $mysqli->query) {
-
add a timestamp field and then ORDER BY timestamp DESC LIMIT 10
-
And what exactly is the question and what are you stuck on ?
-
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>
-
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>"; ?>
-
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
-
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
-
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
-
Find records with the Name MadTechie SELECT * FROM table WHERE name = 'MadTechie' Find records without the Name MadTechie SELECT * FROM table WHERE name != 'MadTechie'
-
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
-
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
-
PHP find text from another page between tags
MadTechie replied to Jnerocorp's topic in PHP Coding Help
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> -
PHP find text from another page between tags
MadTechie replied to Jnerocorp's topic in PHP Coding Help
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"; } -
PHP find text from another page between tags
MadTechie replied to Jnerocorp's topic in PHP Coding Help
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; } -
What the?!? Duplicate entry '0' for key 1
MadTechie replied to xcandiottix's topic in PHP Coding Help
You probably don't have the primary set to AUTO_INCREMENT -
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>"; } ?>
-
Adding curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt ($ch, CURLOPT_SSL_VERIFYPEER, 0); should fix the problem
-
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 ?