Jump to content

MadTechie

Staff Alumni
  • Posts

    9,409
  • Joined

  • Last visited

  • Days Won

    1

Everything posted by MadTechie

  1. Okay so we know the problem then, id isn't being passed via the URL (or its not a number) use the code below <?php $id = (int)$_GET['id']; if( $id > 0 ) { $result = mysql_query("SELECT `name`, `photopath`, `state` FROM `photo` WHERE `id` = $id") or die(mysql_error()); // store the record of the "example" table into $row $row = mysql_fetch_array( $result ); echo "Name: ".$row['name']; echo " photo: ".$row['photopath']; echo " state: ".$row['state']; } else { echo 'BAD PHOTO ID'; echo "<BR />\n--------------------------------"; var_dump($_GET); echo "<BR />\n--------------------------------"; } and give us the results between the ----------------- if you get Array(0) then we're need to see the form its being posted from.. or the href of the link used either way you please confirm that the URL has the id
  2. What's this thing you call Never heard of it.. lol
  3. here is a quick revise <?php $id = (int)$_GET['id']; if( $id > 0 ) { $result = mysql_query("SELECT `name`, `photopath`, `state` FROM `photo` WHERE `id` = $id") or die(mysql_error()); // store the record of the "example" table into $row $row = mysql_fetch_array( $result ); echo "Name: ".$row['name']; echo " photo: ".$row['photopath']; echo " state: ".$row['state']; } else { echo 'BAD PHOTO ID'; }
  4. it will need to be static as well, or create the instance with static class someclass { public static function run($parm) { system($parm); } public static function create($item1,$item2) { self::run($item1 . $item2); } } someclass::create(1,2); new instance class someclass2 { public function run($parm) { system($parm); } public static function create($item1,$item2) { $c = new someclass2(); $c->run($item1 . $item2); } } someclass2::create(1,2);
  5. Whats the actual error ? also you no longer call the function 'getbarcodenumber' and you have two ?> at the end
  6. Here is a little default timezone example echo date_default_timezone_get(); echo date('H:i:s'); date_default_timezone_set('GMT'); echo date_default_timezone_get(); echo date('H:i:s'); see all timezones here timezones
  7. meaning it can't find the function "getbarcodenumber"
  8. Humm.. this doesn't look right to me <?php $weekdays = array($row['specialDaily']);?> if $row['specialDaily'] is "1,2,3" that will create an array with 1 key, ie Array("1,2,3") try this instead explode <?php $weekdays = explode(",",$row['specialDaily']);?> should create Array("1","2","3") Hope that helps
  9. Erm... well function getBarcodeNumber($barcode){ $barcode = (int)$barcode; if(strlen($barcode) > 12) tigger_error('invalid barcode more that 12 digits supplied'); return str_pad($barcode , 12, "0", STR_PAD_LEFT); } $assetNo = 123; $barcode = getBarcodeNumber($assetNo); $pdf->EAN13(10, 120, $barcode);
  10. Simply put. the answer is NO, However their are whys to simulate multi-threading but they are NOT really multi-threads, for example, opening a connection to itself or start a another child process (see pcntl_fork), etc etc
  11. Me either, as theirs no light how about a shot in the dark! $barcode = 12; $barcode = str_pad($barcode , 12, "0", STR_PAD_LEFT); returns 000000000012
  12. its down so the padding used, so you can't just re-hash it! What are you trying to do ?
  13. It maybe me, but i still don't see the actual problem, infact i find calling an object better than calling an array!
  14. I know what you mean, as for error messages, I use my default message if($anything!=true){ echo "User Error"; } Short simple and true and now i can charge 50p and minute for telephone support (just kidding)
  15. Because your pulling 2 rows, for example if i have 2 tables Table A has 1 record Table B has 3 records if i link them and display only for table A i would get the same result 3 times, change FirstName, SurName to * and review the details, without knowing my details about the database its kinda hard to say! but it's likely you are returning 2 more data that you need/want
  16. the file thats causing the error is "check add_formats.php" see link in post above for more info
  17. Yes,$quote is every word in the quoted area, so unset, shuffle, whatever Im glade I could help
  18. Humm.. Seams okay to me!
  19. Just attached a file (tested), but here is the code <?php $data = 'hello world "this is a test" last test'; $RegEx = '/"[^"]*"/i'; if (preg_match($RegEx, $data, $regs)) { $quote = str_word_count($regs[0], 1); unset($quote[1]); //remove IS $data = str_replace($regs[0], '"'.implode(' ', $quote).'"', $data); } echo $data; OUTPUT was: [attachment deleted by admin]
  20. Erm.. isset($hair) will always be true
  21. So is mine close ? yeah RegEx's are like that but the more you do the easier they become, then you tend to over then then LOL
  22. LOL. no worries.. i do that as well.. So erm.. Solved ?
  23. Not sure but do you mean something like this? <?php $data = 'hello world "this is a test"'; $RegEx = '/"[^"]*"/i'; if (preg_match($RegEx, $data, $regs)) { $quote = str_word_count($regs[0], 1); unset($quote[1]); //remove IS $data = str_replace($regs[0], '"'.implode(' ', $quote).'"', $data); } echo $data; return
  24. Normally i would do this $category = (int)$_GET['category']; if(!empty($category)){ //BUT if category is 0 then it will fail, but i use it main for Database ID's } Na, converting to an INT would make the validation pointless as it would be an int no matter what it was before hand
  25. Problem is is_int("10") would return false and GET is returning a string Maybe if(isset($_GET['category']) && ((int)$_GET['category'])==$_GET['category']){ $category = (int)$_GET['category']; //Logic is convert to int and compare to unconverted, //as 10 == "10" is true //ALSO 10 == "10.0" would be true //BUT 10 == "10.2" would be false echo "true = $category"; }
×
×
  • 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.