Jump to content

PaulRyan

Members
  • Posts

    876
  • Joined

  • Last visited

  • Days Won

    4

Everything posted by PaulRyan

  1. I can't give you the code, you have to give it a try yourself, then post when you are stuck. It's a simple INSERT query into the database table.
  2. You could have just posted the code you were getting errors with and somebody would have helped. You now know for the next time you post
  3. A simple question, with a simple answer. Instead of "@yahoo.com", just use "@yahoo."
  4. Here is something I threw together, give it a try. <?PHP //### For test purposes $email = '123@yahoo.com'; //### Array of endings and url to go to $emailArray = array('@yahoo.com' => 'URL 1', '@gmail.com' => 'URL 2' ); //### Iterate over each of the array elements to find a match for the email foreach($emailArray AS $ending => $location) { if(strstr($email, $ending)) { $headerLocation = $location; break; } } //### If the ending is matched, re-direct to that url if(isset($headerLocation)) { echo 'Re-directing to: '.$headerLocation; //### If the ending is not match do something else } else { echo 'Normal form processing'; } ?>
  5. I would personally go with the database approach. Set up a database to store user uploads, possible columns: 1 - id 2 - uploaded_by 3 - file_path 4 - upload_time Then create the upload form/page, Upload page: 1 - Create upload form 2 - On successful upload, add new record to the table Then on the Index page: 1 - Retrieve the records from the table and display them on the page.
  6. The errors are self explanatory, the variables and the indexes are undefined. For index.php $username = isset($_SESSION['username']) ? $_SESSION['username'] : FALSE ; $password = isset($_SESSION['password']) ? $_SESSION['password'] : FALSE ; for both login/register, add the following above the switch statement(going on a limb on this one) $act = isset($_GET['act']) ? $_GET['act'] : FALSE ; For information on the above look up Ternary Operators
  7. Please post the code you are stuck with, as it is pretty much impossible for us to help you properly.
  8. In future, please use the code tags. Try this: <?PHP $con = mysql_connect('127.0.0.1', 'root', ''); if(!$con) { die('Connection Failed: '.mysql_error()); } else { mysql_select_db('test', $con); } //### Assign get variable, if it exists $rowID = isset($_GET['number']) ? (int)$_GET['number'] : FALSE ; //### If the number doesn't exist, display error if(empty($rowID)) { echo 'No row selected to edit.'; exit; } //### Select row from database table $dbQuery = "SELECT * FROM `budget` WHERE `ID` = {$rowID}"; $dbResult = mysql_query($dbQuery) or die(mysql_error()); //### Check if a row was returned if(!mysql_num_rows($dbResult)) { echo 'No row was returned.'; exit; } else { $row = mysql_fetch_assoc($dbResult); } ?> <form method="post" action="edit_data.php"> <input type="hidden" name="ID" value="<?PHP echo $row['ID']; ?>"> <table cellspacing="0" cellpadding="0" border="0"> <tr> <td> AMOUNT </td> <td> <input type="text" name="amount" size="20" value="<?PHP echo $row['AMOUNT']; ?>"> </td> </tr> <tr> <td> PUPOSE </td> <td> <input type="text" name="purpose" size="40" value="<?PHP echo $row['PURPOSE']; ?>"> </td> </tr> <tr> <td> DATE </td> <td> <input type="text" name="date" size="40" value="<?PHP echo $row['DATE']; ?>"> </td> </tr> <tr> <td> NAME </td> <td> <input type="text" name="name" size="20" value="<?PHP echo $row['NAME']; ?>"> </td> </tr> <tr> <td align="right"> <input type="submit" name="submit value" value="Edit"> </td> </tr> </table> </form>
  9. Please show us the code from counter.php and the top 20 or so lines from index.php.
  10. QuickOldCar, the variable $user_input should be inside of the if statement, otherwise it will display an error. Providing that errors are set to be displayed, which they should be. <?PHP if($_SERVER['REQUEST_METHOD'] == 'POST') { $user_input = isset($_POST['user_input']) ? trim($_POST['user_input']) : FALSE ; if(empty($user_input)) { echo 'No user input entered.'; } else { echo 'User Input: '. $user_input; } } ?> <form action="" method="POST"> <input type="text" name="user_input" size="20"> <input type="submit" name="press" value="Press da button!"> </form>
  11. Codelinx, that wouldn't do anything, his submit is not named "submit" it is named "press". I would personally go with: <?PHP if($_SERVER['REQUEST_METHOD'] == 'POST') { ..... } ?>
  12. Use a database to store all of the file names and file paths, then do a search on the database instead of searching the directory each time.
  13. You need to put back ticks around the column name as you have a space in its name. `job status` Personally, I replace all spaces with underscores to avoid such errors and looks better in my opinion.
  14. You have not connected to the database as far as I am aware, so you need to do that first. Secondly, you are not executing the MySQL queries, just merely assigning them to a variable. You need to look into PHP a bit more look at $_GET. Then you need to move away from MySQL and look to MySQLi also, so read up on that too.
  15. I personally would load the news from the MySQL table into a JS array and then cycle through them 1 by 1. You could create a scrolling div or just fade the news in and out using jQuery or plain JS.
  16. Try using this: $stmt = $mysqli->prepare("SELECT * FROM $tbl_name WHERE phone_number=? AND group_leader IS NULL") or die($mysqli->error);
  17. Always use return. Using echo will echo out the content where ever the function is called, so if you called the function before the header etc, it would display whatever you echo above the header. Using return, you assign the function call to a variable for use later on in the code.
  18. Please post your updated code, so I can see the changes.
  19. You do not need 2 WHERE clauses. "SELECT * FROM $tbl_name WHERE phone_number=? AND group_leader IS NULL" 2 hours well spent
  20. You do not need the dot between the 2 variables, as this adds an actual dot between the 2 values. Use this instead: <img id='cpt_img' src='{$path}{$img}'>
  21. Bump all you want, you need to post your code before anyone will think about helping.
  22. 1 - An error in your query most likely. 2 - isset 3 - The function sqlerr does not exist or you haven't included the relevant file for it to exist.
  23. @Muddy_Funster - Kudos, had a complete brain fart with that.
  24. You are using "mysql_fetch_array($result)" which actually returns an array of the values using numbers e.g. "$row[0]" Try using this: while ($row = mysql_fetch_assoc($result))
×
×
  • 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.