Jump to content

Ch0cu3r

Staff Alumni
  • Posts

    3,404
  • Joined

  • Last visited

  • Days Won

    55

Everything posted by Ch0cu3r

  1. Didn't think that was possible. Seems a bit broken to me.
  2. Not every thing no. That is the forums syntax highlighting The urls in the $brokers array. Enter each of your brokers websites into that array. As Barand has demonstrated You don't change that, date is a PHP function, z is used to get the curent day of the year http://php.net/date Yes change the iframe code to <div id="iframe"><iframe id="iframeHome" src="<?php echo $todaysURL; ?>" frameborder="0">Browser Not Compatible</iframe></div>
  3. Just noticed the form you're echo'ing out, the form doesn't have a submit method defined. echo "<form>"; By default forms submit method is GET. You need to set the forms submit method to post. echo "<form method='post'>"; Also the input tags for the password fields are not closed properly either. echo "New Password<input type='text' name='newpassword1'></td></tr>"; echo "<tr><td>"; echo "Re-Enter Password<input type='text' name='newpassword2'></td></tr>";
  4. No the constructor is only called when you throw an error. To see when the __constructor is called, change it to this function __construct($message, $lineNumb, $email) { $this->message = $message; $this->notifyAdmin($email); echo "<br>" . __CLASS__ . ' was called on line <b>' . $lineNumb . '</b> and set the following error - <b>' . $message . '</b>'; echo "<br>"; } Now change throw new Invalid_Email_Exception("Invalid e-mail address!", $email); to throw new Invalid_Email_Exception("Invalid e-mail address!", __LINE__, $email); Run your code and you should get the following output Invalid_Email_Exception was called on line 40 and set the following error - Invalid e-mail address! Invalid e-mail address! I think the order for the catch() blocks need to be reversed, so check for the Invalid_Email_Exception first followed by checking for Exception } catch (Invalid_Email_Exception $e) { echo $e->getMessage(); } catch (Exception $e) { echo $e->getMessage(); }
  5. You're getting the error message twice because you're echo'ing the error message when you throw the error (in the constructor) and when you catch the error. When you throw the error throw new Invalid_Email_Exception("Invalid e-mail address!", $email); This will call the __constructor method for the Invalid_Email_Exception class class Invalid_Email_Exception extends Exception { function __construct($message, $email) { $this->message = $message; $this->notifyAdmin($email); echo $message; echo "<br>"; } ... On line 15 you set the error. On 17 you echo the error. The error is caught in the try catch block and echo'd again.
  6. Check that the query is not returning an error Change $query = $mysqli->query("SELECT `Credit`, `Debit`, `Catagory` FROM `transactions WHERE `Accname`=$Accname"); if($query->num_rows>0){ echo "Yes"; } else{ echo "No"; } to // if query return true if($query = $mysqli->query("SELECT `Credit`, `Debit`, `Catagory` FROM `transactions WHERE `Accname`='$Accname'")) { // see how many rows where returned if($query->num_rows>0) { echo "Yes"; } else{ echo "No"; } } // query returned false, due to an error else { // get error echo 'Query Error: ' . $mysqli->error; exit; }
  7. So this is solved? If that is the case make sure you're using an editor with syntax highlighting.
  8. $Accname needs to be wrapped in quotes in the second query $mysqli->query("SELECT `Credit`, `Debit`, `Catagory` FROM `transactions WHERE `Accname`='$Accname'");
  9. First issue localhost should be in quotes $con=mysqli_connect(localhost,$username,$password, $database); Second issue the the variables $quantity and $id do not appear to be defined any where. Where are these variables defined? Third issue $mysqli->query("UPDATE sale SET `quantity`='$ud_quantity' WHERE `index`='$id'"; The $mysqli object doesn't exist. You're using the procedural function to connect to mysq there for you should use the procedural mysqli_query function. Also you where missing the closing parenthesis at the end of the line too. The above line should be mysqli_query($con, "UPDATE sale SET `quantity`='$ud_quantity' WHERE `index`='$id'"); Fourth issue printf("Affected rows (UPDATE): %d\n", $mysqli->affected_rows or die(mysql_error()); The or die() clause is in the wrong place, it should be after the mysqli_query() call. mysql_error should be mysqli_error() As a side note the switch statement could be rewritten as a simple if/else statement if($quantity >= 0 && $quantity <= 30) $ud_quantity = $quantity + 1; else $ud_quantity = 'ERR';
  10. Not sure what you're wanting to do, but if you want the user to select multiple locations you'd setup the form like <form action ="location.php" method="post"> <p><input type="checkbox" name="locations[]" value="Auckland" /> Auckland</p> <p><input type="checkbox" name="locations[]" value="North Shore" /> North Shore</p> <p><input type="checkbox" name="locations[]" value="Waikato" /> Waikato</p> <p><input type="checkbox" name="locations[]" value="Taranaki" /> Taranaki</p> <p><input type="checkbox" name="locations[]" value="Taupo" /> Taupo</p> <p><input type="checkbox" name="locations[]" value="Wellington" /> Wellington/p> <p><input type="checkbox" name="locations[]" value="Bay of lenty" /> Bay of Plenty</p> <p><input type="checkbox" name="locations[]" value="Manukau" /> Manukau</p> <p><input type="submit" name="submit" value="submit" /></p> </form> The location goes in the value="" attribute for each checkbox. Then in location.php the $_POST['locations'] variable will contain an array of selected locations. Example code for location.php, for displaying the selected locations <?php if(isset($_POST['submit'])) { echo 'You have selected the following locations: '; echo '<ul><li>' . implode('</li><li>', $_POST['locations']) . '</li></ul>'; } ?>
  11. of what? Shouldn't data_dump($pictures['id']); here if ($btnVote !== false) { #header('Location: http://localhost/contest/?='.$pictures['id']); echo data_dump($pictures['id']); } be data_dump($btnVote);
  12. OK, you'll do it via FTP or Godaddys Account Manager. Change the chmod permission to 0755 for the mstabosz folder
  13. Its a file permissions issue. The mstabosz folder needs to have the correct write permissions set so PHP can write uploaded files to that folder, by default on linux based servers non owners of folders/files can only read. Try chmod'ing the mstabosz folder to 755 using chmod before you use move_uploaded_file function.
  14. This query you're referring to? $sql = "Select user_name from users"; $result = mysql_query($sql); If its then you're not selecting the cat_name from the database, you're only getting the user_name from the users table. Therefore the second drop down will be empty, In what table is the field the cat_name from?
  15. When you upload images, don't save the actual image into the database. Only save the filepath (where you uploaded the image too) in the database. When you query the database to display the image you'd do something like echo '<img src="'.$row['image_path'].'" />'; Saving the actual image into the database makes things alot more complicated. Uploading the file and storing on the file system and then linking it in the database is a hell of a lot simpler
  16. Ch0cu3r

    help

    What do you mean by that? What is corrupted, xampp comes with many components, such as apache, PHP, MySQL, phpMyadmin etc. Which of these are you saying is corrupted? There is an error on line 6 of trip.php. PHP cannot continue, unless you fix that error. What is trip.php?
  17. Ch0cu3r

    help

    That is why. You cannot fun PHP code directly in a web browser. You need to have a server installed that is configured with PHP. You access the server via its url followed by your php file, for example http://server-address/file.php Make sure you still have xampp installed? Run xampp and put into your web directory (I think its C:\xampp\htdocs) and then go to http://localhost/ to run your PHP code.
  18. Ch0cu3r

    help

    When you open your browser to run the PHP file what is the url you're using? Does the url start with http:// or file://
  19. Ch0cu3r

    help

    Are you running the code on a server that is configured with PHP? and is that the full complete code you have?
  20. What do you mean by that? Can only get one drop down menu to display? The code that generates the dropdown menus looks ok. How are you getting the user_name and the cat_name fields from the database?
  21. The solution would be to either learn PHP and fix the problem yourself, or find a better script that is coded properly or pay someone to fix the script for you.
  22. The problem is here if(in_array($myarray['column1'], $allowed)) { foreach ($myarray as $array) { if(!empty($myarray['column1'])) { echo $myarray['column1'].': '.$myarray['column2'].'<br />'; } } } The reason you get duplicated results is because the foreach loop is looping through the values (column1 and column2) of $myarray and is running the code within that loop twice! You do not need the foreach loop. The code should be if(in_array($myarray['column1'], $allowed)) { if(!empty($myarray['column1'])) { echo $myarray['column1'].': '.$myarray['column2'].'<br />'; } } The only time you'd need the foreach loop if $myarray contains multiple arrays, eg $myarray = array(); $myarray[0]['column1'] = 'param1'; $myarray[0]['column2'] = '12345678'; $myarray[1]['column1'] = 'bad_param2'; $myarray[1]['column2'] = '87654321'; $myarray[2]['column1'] = 'param3'; $myarray[2]['column2'] = '12345678910'; Then your foreach loop would be foreach ($myarray as $array) { if(in_array($array['column1'], $allowed)) { if(!empty($array['column1'])) { echo $array['column1'].': '.$array['column2'].'<br />'; } } } Then result would be param1: 12345678 param3: 12345678910
  23. Well that screenshot has nothing to do with MySQL. The errors in the screenshot is from PHP. The undefined index errors are caused because the script is trying to access an associative array with an index that doesn't exist. This is due to the scripts poor coding. There is probably code like if($some_var['some_index']) { // do something } Which should be if(isset($some_var['some_index'])) { // do something }
  24. Why are you dividing a string with a number?
  25. No, demo.php and dynamic.php are completely different scripts. They will not work together as they are. You need to de-construct the code for the sliding login panel from demo.php and work out how to integrate it into your dynamic page. You cannot simply include one file into the other and expect it all to work. The following is a way to integrate the two scripts, but I am not guaranteeing if the two scripts will work together in this way. First copy the css and javascript code (lines 106 to 128 in demo.php) into the <head></head> of the fra_header.html page. Then copy and past the <div id="toppanel"> ... </div> code (lines 134 - 236 from demo.php) to the end of fra_header.html file (after line 42) Now the php code on lines 1 - 96 from demo.php to the top of dynamic.php. Now if you open dynamic.php on each page under the header the login slider should appear.
×
×
  • 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.