-
Posts
9,409 -
Joined
-
Last visited
-
Days Won
1
Everything posted by MadTechie
-
Shot in the dark, but check your functions (ie ProfileFollowLink) don't echo value and do return a value!
-
Remove the white space (the tab) <?php if (( ! isset ( $this->_tpl_vars['is_teacher'] ) ) && ( ! isset ( $this->_tpl_vars['is_admin'] ) )): ?> {TAB}<?php header("location:index.php");die(); ?> <?php endif; ?> or change to this <?php if ( !isset($this->_tpl_vars['is_teacher']) && !isset($this->_tpl_vars['is_admin']) ){ header("Location: index.php"); die(); }
-
Showing and disabling specific data from mysql
MadTechie replied to Darkwoods's topic in PHP Coding Help
Add to the WHERE AND ID NOT IN (2,5) OR at the start of a loop (after setting $id) add if($id == 2 || $id == 5) continue; -
For multiple entries change $all_value_check = implode(", ", $_POST['Ship']); mysql_select_db($database_mysite, $mysite); $query_Ship = "SELECT Date, Route, Ship, Port FROM Test Where Ship = '{$all_value_check}'"; to $all_value_check = implode("','", $_POST['Ship']); mysql_select_db($database_mysite, $mysite); $query_Ship = "SELECT Date, Route, Ship, Port FROM Test Where Ship IN ('{$all_value_check}') "; Anyone want to chat about SQL Injection ?
-
your over writing the $results, change $result = mysql_query("SELECT * FROM food_menu WHERE cat_id='$title' ORDER BY id ASC",$connect); while ($row = mysql_fetch_array($result)) to $result2 = mysql_query("SELECT * FROM food_menu WHERE cat_id='$title' ORDER BY id ASC",$connect); while ($row = mysql_fetch_array($result2))
-
I believe I have helped! in any case your welcome!
-
You could use a DOMXPath,
-
That's because they added a - a simple RegEx update would be <a href="([^"]+)">([^<]+)</a> - (?:<font size="-1">([^"]+)</font>)? Also i have pointed this out before but do you have permission to collect this data ? as if you don't it would be unlawful!
-
Okay well if you must use a RegEx, then here's an ugly one <td class="mobile_pen_right_alt"></td></tr><tr><td class="mobile_pen_left"></td><td class="mobile_pen"> <div class="mobile_threadbit"> <div class="mobile_threadbit_title"> <a href="showthread.php?t=18523545" id="thread_title_18523544">Steroids can't be tested on everyone</a> </div> <div class="mobile_threadbit_details"> Today 06:31 PM - <a href="member.php?u=4674" rel="nofollow">dudeabiding</a> <!-- Replies Views --> <br>Replies: 0 - Views: 142 - <a href="showthread.php?t=18523544&page=">Last Page</a> <br> </div> </div> </td><td class="mobile_pen_right_alt"></td></tr><tr><td class="mobile_pen_left"></td><td class="mobile_pen"> <div class="mobile_threadbit"> <div class="mobile_threadbit_title"> <a href="showthread.php?t=18523545" id="thread_title_18523545">Cleveland Indians 2010 Odds</a> </div> <div class="mobile_threadbit_details"> Today 06:31 PM - <a href="member.php?u=4971" rel="nofollow">larrypaging</a> <!-- Replies Views --> <br>Replies: 0 - Views: 142 - <a href="showthread.php?t=18523545&page=">Last Page</a> <br> <span> <img class="inlineimg" src="/images/rating/rating1.gif" border="0" alt="Votes: 1 Score: 1" /> </span> </div> </div> </td><td class="mobile_fun_right"></td></tr><tr><td class="mobile_fun_left_alt"></td><td class="mobile_fun_alt"> <div class="mobile_threadbit"> <div class="mobile_threadbit_title"> <a href="showthread.php?t=18523546" id="thread_title_18523546" style="font-weight:bold">We need another thing like the Albert Belle Candy Bar</a> </div> <div class="mobile_threadbit_details"> Today 06:24 PM - <a href="member.php?u=5614" rel="nofollow">lofton4ever</a> <!-- Replies Views --> <br>Replies: 3 - Views: 292 - <a href="showthread.php?t=18523546&page=">Last Page</a> <br> <span> <img class="inlineimg" src="/images/rating/rating-2.gif" border="0" alt="Votes: 2 Score: -2" /> </span> </div> </div> </td> preg_match_all ( '%<a href="showthread\.php([^"]*)"[^>]*>([^<]+)</a>\s*</div>\s*<div class="mobile_threadbit_details">\s*[^<]*[^<]*[^>]*>[^>]*>\s*<!-- Replies Views -->\s*<br>Replies: \d+\s+[^>]*>[^>]*>\s*<br>\s+<span>\s*<img [^>]*? alt="Votes:\s+\d+\s+Score: ([\d-]+)%sim', $html, $results, PREG_SET_ORDER ); foreach ( $results as $result ) { echo $result [1] . " -> "; echo $result [2] . " -> "; echo $result [3] . "<BR />\n"; } seam correct to me!
-
Without me having to look though all the code, just echo out the $width & $height.
-
this should do it ^([a-z -]+):\s+([\d\.]+)\s+([a-z -]+):\s+([\d\.]+)
-
if your testing every line add ^ to the start of the regex if (preg_match('/^([a-z -]+)(\d+)(?:[ ]+([a-z -]+)(\d+))?/im', $str[$i], $regs1)) {
-
Humm, Works fine here I just tested it $data = 'Small Cargo 5 Light Fighter 556 Cruiser 3 Colony Ship 1 Espionage Probe 10 Solar Satellite 50'; $str = explode("\n",$data); foreach($str as $s){ if (preg_match('/([a-z -]+)(\d+)(?:[ ]+([a-z -]+)(\d+))?/im', $s, $regs)) { $Weapon1 = $regs[1]; $Power1 = $regs[2]; $Weapon2 = $regs[3]; $Power2 = $regs[4]; echo "$Weapon1 ($Power1)-> $Weapon2($Power2)<BR />\n"; //debug } } returns
-
Let me stop you their, That's NOT XML, its barely a snippet of html Assuming self.xml is a string, can't you just use var postData = "xml="+self.xml; then pick up the $_POST['xml'] form the PHP side
-
If your breaking it up by line then, you don't need the start and end line tags So try this if (preg_match('/([a-z -]+)(\d+)(?:[ ]+([a-z -]+)(\d+))?/im', $str[$i], $regs)) { $Weapon1 = $regs[1]; $Power1 = $regs[2]; $Weapon2 = $regs[3]; $Power2 = $regs[4]; echo "$Weapon1 ($Power1)-> $Weapon2($Power2)<BR />\n"; //debug }
-
try this preg_match('/^([a-z -]+)(\d+)(?:[ ]+([a-z -]+)(\d+))?$/im', $html, $regs); $Weapon1 = $regs[1]; $Power1 = $regs[2]; $Weapon2 = $regs[3]; $Power1 = $regs[4]; //counter Percent preg_match('/^Chance of counter.*?:\s+(\d+)\s+%\s+$/im', $html, $regs); $counter= $regs[1];
-
I'm sorry but I don't understand what your trying to do as your questions don't seam to fit with your logic and your logic has holes! for example where does the XML get generated ? what parameters are sent from ajax ?
-
You have 4 columns and 3 inputs, So you can either do this $query = "insert into orders set (`email`, `zip`, `time`) values ('".$purchase_email."', '".$zip."', '".$current_date."')"; or $query = "insert into orders values (null,'".$purchase_email."', '".$zip."', '".$current_date."')";
-
I'm glade that all is working and am sure that your find this forum a great resource, I'll be happy to help out (where time permits) as I'm sure others will also help, Just make sure you read the code at the end and make sure you understand it all, and try to write the code again (but try to refer to your working as little as possible) this will help highlight what parts you need to work on. Oh and one thing you need to keep in mind, Now you seam like you want to learn instead of just pass so you should be okay on a last note, in the bottom left theirs a mark solved button, click that to mark this post as solved (you can unsolved it if needed) EDIT: I marked this as solved for you
-
okay.. lets try this a different way.. what are you trying to do, as i fail to see the reason for sending an xmlfile php via ajax (the truth of the matter is that your not sending the file), why not just send a request with the filename and have PHP pick the name and read it in.
-
Okay I'm a little unsure but i think this is what you want! preg_match_all ( '%<a href="showthread\.php([^"]*)"[^>]*>([^<]+)</a>.*?<br>\s*?<span>\s*<img [^>]*? alt="Votes:\s+\d+\s+Score: ([\d-]+)%si', $html, $results, PREG_SET_ORDER ); foreach ( $results as $result ) { echo $result [1] . " -> "; echo $result [2] . " -> "; echo $result [3] . "<BR />\n"; }
-
Opps noticed the minus, on the score Here is a full example preg_match_all('%<a href="showthread\.php([^"]*)"[^>]*>([^<]+)</a>.*?alt="Votes:\s+\d+\s+Score: ([\d-]+)%si', $html, $results, PREG_SET_ORDER); foreach($results as $result){ echo $result[1]." -> "; echo $result[2]." -> "; echo $result[3]."<BR />\n"; }
-
Ahh $html, $regs)); should be $html, $regs);
-
try this preg_match('%<a href="showthread\.php([^"]*)"[^>]*>([^<]+)</a>.*?alt="Votes:\s+\d+\s+Score: (\d+)%si', $html, $regs)); unset($regs[0]); print_r($regs);
-
Okay, the error, (always read them) So line 5 & 6 would be $account = $_POST['account']; $balance= $_POST['balance']; and Undefined index means it $_POST['account'] & $_POST['balance'] don't exist.. but why ? Well because we are sending GET and expecting POST So change METHOD="GET" to METHOD="POST" (as we are using $_POST instead of $_GET in our code) now that should fix balance, but your still get the error for account .. Why ? Well look, we send <input type="text" name="account number" /> and expect $account = $_POST['account']; Now it IS POST but the name is different So name="account number" should be name="account" Try that