Search the Community
Showing results for tags 'working'.
-
My error codes are not working , i declared them as follow if(isset($_POST['login_submit'])){ $query = mysql_query("SELECT id FROM users WHERE login_email = '". $_POST['login_email'] ."'") or die(mysql_error()); $email_check = mysql_num_rows($query); $email_check_data = mysql_fetch_array($query); if(empty($_POST['login_email']) || empty($_POST['login_password'])){ echo "<div class=\"notification warning\"> Please fill in all the fields below </div>"; } elseif($email_check == 0) { echo "<div class=\"notification error\"> Email address or password . Please check your email! </div>"; is there anything wrong ? If the fields are empty or i input no email or password no erros displayed
-
hi ive been trying to sort this out all day, im very inexperianced in php but really want to do well in it and at the moment ive got a table working linked to a database and which pulls records but now i want to get an update and delete button but i cant seem to hack it heres the code. <?php $con = mysqli_connect("localhost","root","","lcm"); // Check connection if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); } //updates table. if (isset($_POST['update'])){; $UpdateQuery = "UPDATE tbl_contactinfo SET Name='$_POST[Name]', Address='$_POST[Address]' WHERE Name='$_POST[hidden]'"; mysql_query($UpdateQuery, $con); } if (isset($_POST['delete'])){; $DeleteQuery = "DELETE FROM tbl_contactinfo WHERE Name='$_POST[hidden]'"; mysql_query($DeleteQuery, $con); } //selects the table. $sql = "Select * from tbl_contactinfo"; if ($result = mysqli_query($con, $sql)) { echo "<table border='1'> <tr> <th>Name</th> <th>Address</th> </tr>"; while($row = mysqli_fetch_array($result)) { echo '<form action="index1.php" method="post">'; echo '<tr>'; echo '<td><input type="text" name="name" value="' . $row['Name'] . '" /></td>'; echo '<td><input type="text" name="address" value="' . $row['Address'] . '" /></td>'; echo '<td><input type="hidden" name="hidden" value="' . $row['ID'] . '" /></td>'; echo '<td><input type="submit" name="update" value="update" /></td>'; echo '<td><input type="submit" name="delete" value="delete" /></td>'; echo '</tr>'; echo '</form>'; } echo "</table>"; } ?> <html> <body> <form action="insert.php" method="post"> Name: <input type="text" name="Name"> Address: <input type="text" name="Address"> <input type="submit"> </form> </body> </html> and error messages ive been getting. ( ! ) Notice: Undefined index: Name in C:\wamp\www\Index1.php on line 12 Call Stack # Time Memory Function Location 1 0.0000 147208 {main}( ) ..\Index1.php:0 ( ! ) Notice: Undefined index: Address in C:\wamp\www\Index1.php on line 12 Call Stack # Time Memory Function Location 1 0.0000 147208 {main}( ) ..\Index1.php:0 ( ! ) Warning: mysql_query() expects parameter 2 to be resource, object given in C:\wamp\www\Index1.php on line 13 Call Stack # Time Memory Function Location 1 0.0000 147208 {main}( ) ..\Index1.php:0 2 0.1562 154608 mysql_query ( ) ..\Index1.php:13 these are for update and for delete ( ! ) Warning: mysql_query() expects parameter 2 to be resource, object given in C:\wamp\www\Index1.php on line 18 Call Stack # Time Memory Function Location 1 0.0000 147208 {main}( ) ..\Index1.php:0 2 0.1406 154456 mysql_query ( ) ..\Index1.php:18 ive stoped the error messages before dont no how i did it but they wernt showing, only problem is when i pressed them nothing happened any help will be great.
-
Hello. I have a quick question (it's probably easy to solve): why isn't the below code working? <?php $myFile = "testFile.txt"; $fh = fopen($myFile, 'w+'); $theData = fread($fh, 5); fclose($fh); echo $theData; ?> All I get is a blank page. Nothing is displayed, and I'm not sure what to do.
-
Hello Everyone. Till now I used to work on XAMPP and WAMP but today I tried installing Apache,PHP,and MySQL seperately(MAnually). For that I downloaded Apache(httpd-2.0.64-win32-x86-openssl-0.9.8o.msi), PHP(php-5.3.17-Win32-VC9-x86.msi) MySQL(mysql-5.5.28-win32.msi). First I installed Apache.Everything went right and on opening http://localhost it said that apache is correctly installed on your pc. Then I installed PHP.While installing,it asked for httpd.conf file so I provided it and everything went fine. Then I created a file named phpinfo.php in htdocs folder and wrote the following code in it <?php phpinfo(); ?> But when I opened the url http://localhost/phpinfo.php it is showing the following error. Please hefp me out.Unable to solve it.