No one has voted on any posts yet. Votes from other community members are used to determine a member's reputation amongst their peers.
Computer Nerd :)
- PC Specs
- Windows 7
26 Posted Topics
How would one include a footer on a page if PHP has stopped executing during an error? | |
For example, I have a string containing "184553", how do I go about extracting the 3rd character "4" from string string and assigning it to another variable? I have tried the following code but it does not work, the system crashes: [CODE] char string[6] = "184553"; printf("%s",string[2]); // Expecting it … | |
Re: This line: [CODE]$sql = "SELECT count(*) as count FROM Users WHERE username = '$username' and `password` = '$password'"; $result = mysql_query($sql) or die(mysql_error());[/CODE] Should be: [CODE]$sql = "SELECT count FROM Users WHERE username = '$username' AND password = '$password'"; $result = mysql_query($sql) or die(mysql_error());[/CODE] and [CODE] $sql = "SELECT role … | |
Is it possible to obtain the next insert ID without actually executing a proper insert query? I am writing a file upload script but the name of the folder the file gets uploaded to depends on the next insert ID of a certain table. Would appreciate any help with this. | |
I don't know if it's obvious but I'm not entirely sure how to delete joined table records? For example. I have a project which also has associated contracts, files etc in other tables. They are all linked using the project foreign key. How do I construct a query to that … | |
Is it possible to use PHP and a mysql query combined to allow a whole database backup file to be downloaded? For example, I'm currently backup up my database by using the export tool in phpmyadmin, but what if I wanted to add a button or link on my site … ![]() | |
Re: You need to encase your array variables with curly brackets like this: [CODE]'{$_POST[register_username]}'[/CODE] ![]() | |
Re: How WOULD you do it anyway? I am intrigued, enlighten me, Arsench :) | |
I am having trouble with a certain query. The problem is that I am using an INNER JOIN with two tables that both have a column called "id". I want the query to return ALL the column names but in addition I also want table1.id to be returned as id1 … | |
Any way to change the formatting of the text and what is displayed after a die() command? I'm currently coding all my errors using die() but I'd like to have more control over how the error message is formatted and what is displayed afterwards (like a return link for example) | |
How do I code a function that uses external variables? For example? I have an upload script that I am using repeatedly through a few pages. I'd like to make my code more efficient and just define the upload script as a function and call it every time I need … | |
I have this code to validate part of a file upload: [CODE]if (!($fileExt == 'doc' || $fileExt == 'docx' || $fileExt == 'pdf')) { $error = 'The file does not meet the file type requirments. Only Microsoft Document and PDF files are allowed.'; $etype = '1'; include ('inc/error.php'); }[/CODE] Is … | |
[CODE]$query = "INSERT INTO update_feedback (updateID,comment,timestamp) VALUES ('$updateID','$comment',NOW())"; $result = mysqli_query($dbcon,$result) or die('Error saving feedback into database. ' .mysqli_error($dbcon));[/CODE] Gives me this error: [QUOTE]Error saving feedback into database. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax … | |
Re: Not sure if that was meant to be sarcastic, but isn't it incredibly naive of you to think someone's going to spend time teaching you PHP without anything in return? I would recommend paying a visit to w3schools, that's the best you'll have for now unless you can afford to … | |
Re: [CODE]function validate_email($email) { if (strlen($email) < 3) { return false; } if (!preg_match('/^[_A-z0-9-]+((\.|\+)[_A-z0-9-]+)*@[A-z0-9-]+(\.[A-z0-9-]+)*(\.[A-z]{2,4})$/', $email)) { return false; } else { return $email; } }[/CODE] | |
Just wondering if it normal and acceptable use both on one string before entering it into a database or displaying it? For example: [CODE]$project_name = mysqli_real_escape_string($dbcon,htmlspecialchars($_POST['project_name']));[/CODE] | |
I have a dropdown list and the selected item depends on the record the form is for. How do I allow PHP to determine which item in the list is selected according to how that row is configured? | |
I have a date in the form DD-MM-YYYY, I know how to explode it into just DD, MM and YYYY on its own but how do I check if this date is valid? For example 01-02-2009 is valid but 31-02-2009 is not. Any way to check this? ![]() | |
I have a small problem with a MYSQL select query involving an INNER JOIN. Both tables that I'm joining have a field that have identical names. So when I use[CODE] $array = mysqli_fetch_array($result,1); $field = array['fieldname'];[/CODE] it returns the wrong value from the wrong table. Is there any way around … | |
I have a select menu with many text-based options. However when I submit the form, instead of actually returning the textual item in the POST variable is it possible to set it to return the ID of the selected item? For example I have the following form: [CODE]<select name="dev_stage" id="dev_stage"> … | |
I have a date in the format of YYYY-MM-DD as a string (including the hyphens) How do I split this string just to obtain YYYY, MM and DD separately? Possible use of an array or something? Would really appreciate some help :) Edit: Nevermind, just discovered the explode() function :P | |
I have the following file called config.php. These are configuration options for a client management system. I need these settings to be editable via the system admin panel. How would I go about storing these values in a database? Would it make sense to have a table called "config" with … | |
I have a table called projects, and I'm currently coding the "create a project" functionality that allows the administrator to create a new project and save it in the projects mysql table. I have a slight problem though, I have two fields/inputs named start date and deadline date, what should … | |
I have a section in my PHP page containing this bit of code: [CODE] echo '<div style="float:left;"><h3><strong>Edit User Account</strong></h3> Date Registered: ' . $db_regdate . '<br> User Type: ' . $usertype . '<br><br> <form class="right_aligned" id="form1" name="form1" method="post" action=""> <label>First Name*</label> <input name="firstname" type="text" id="firstname" value="' . $db_firstname . '"/> … | |
I am currently working on a client management system for my Computing Coursework and I've come to the "Client Details" section, which allows staff and admin to view personal information about each client. I've successfully coded the query and everything else around it, I'm just a but stuck on how … | |
I am currently working on a client management system for a college project. I am planning to include a feature to allow users to upload files for a specific project. All files will be specific to one project and clients can only view files for a project that they are … |
The End.