Program Parkir Dengan Php

Posted on  by admin
Program Parkir Dengan Php Average ratng: 6,2/10 8328 reviews

I want to retrieve data from MySql table. I am using Xampp, phpMyAdmin etc.. I followed this tutorial step by step: https://www.youtube.com/watch?v=IHdd02IK2Jg

But I get this error:

Notice: Undefined variable: records in C:XAMPPhtdocsdisplay_prsc.php on line 29

And a warning: Darussalam books in urdu free download pdf.

Warning: mysql_fetch_assoc() expects parameter 1 to be resource, null given in C:XAMPPhtdocsdisplay_prsc.php on line 29

It just displays the column names when i run it.

ma_pma_p

5 Answers

Note the space in your first php tag. You have <? php , it should be <?php

And since it seems you are starting to learn, avoid learning things deprecated. Don't use MySQL, use PDO or Mysqli.

lmarcelocclmarcelocc

You have a few errors in your code:

1. Wrong php opening tag

You have to remove the space in your php opening tag, e.g.

2. Weird html

Almost your entire html is wrong! I would recommend you to read a book or watch a basic html tutorial

So your entire code should look something like this:

Solidworks 2017 torrent crack. N64 controller serial protocol sniffer. Side Notes:

1. What can be improved?

  • I would do some basic error checking e.g. if the connection failed and so on
  • Use mysqli_* with prepared statements, or PDO with prepared statements, they are much safer! (We live in 2015)
  • (Also if the guy in your tutorial uses mysql_*, change the tutorial!)

So that you don't only have your old code working, here your improved code:

2. Coding side notes

Add error reporting to the top of your file(s) which will help find errors.

Error reporting should only be done in staging, and never production.

Rizier123Rizier123
srinath madusankasrinath madusanka

I recommend you using Prepared statements for MySQL instead of clean MySQL, it's not secure at all, and will give you problems later on.

A lille guide here.
http://www.w3schools.com/pHp/php_mysql_prepared_statements.asp

DjipDjip

There are multiple errors in your code. But for the error, it is due to mysql_query() returns FALSE at line:

Then, the line while ($new=mysql_fetch_assoc($records)){ cannot get the value of $records, thus produce the errors.

Other errors are:

HTML

  • missing DOCTYPE
  • missing meta charset
  • a missing </tr>
  • a misplaced </head>
  • be modern, use CSS to style your HTML instead of using HTML tag attributes

PHP

  • didn't check the return value of functions before using them
  • use of deprecated mysql_* functions; use PDO / MySQLi instead
  • extra space at <? php
RaptorRaptor

Not the answer you're looking for? Browse other questions tagged phphtmlmysqlapachehtml-table or ask your own question.