I have a test database set up on localhost. I have a form that I can type a name into, hit the button and it puts the name into the database and into a list on my page. it works fine. Now, I wanted to make a drop down list with all the names so that you could select one to remove that name from the database. So I did this
Code: <form>
<select>
<option><?php echo $name ?></option>
</select>
</form>
What that did was list the very last name in the list. What I thought it would do was list all the names based on the loop that I have set up to read all the names from the database. which is this
Code: $mysql = new mysqli('localhost', 'myusername', 'mypass', 'mydatabase') or die('not working');
$result = $mysql->query("SELECT * FROM myTable") or die($mysql->error);
if($result)
{
while($row = $result->fetch_object())
{
$name = $row->names;
echo $name . "<br />";
}
}
Now the while loop is in a file I called results and it is included in the index page with an include. I thought this would give me access to the $name variable and allow me to use it the same way it's being used in the loop. of course I was wrong, so how do I use it the same way?
Log $_POST
How would i log submits on a form, by everyone? I want to then echo the number of submissions.I've tried this:Code: [Select]<?phpif (isset($_POST['submit'])) {$myFile =
Remove Rows From Database ad
Hi All,I have this:Code: [Select]<?phpsession_start();include('../common/dbconnect.php');$stock_id = $_GET['stock_id'];$query='SELECT * FROM users_stocks WHERE user_id ="' .
server trace logs
could any one tell me from where do i get error logs in xMII??I want to check the reason for dtabase connection failure
Snapshot from video
anyone knw how to make a snapshot maker from avi n mkv format.for example if i give a direct link (mysite.com/song.avi) then it will give a snapshot in jpg format
Header is not working in IE
Hi ! header function is not working in IE but it works in FF, Safari, Chrome. any help please. :if (isset($_POST['sub1'])) { $id = $_POST['cscstest']; $qty = $_POST['cscsqty']; $id =
Rounding a number queried from a database
I know that to display a rounded number you just do echo "round($number)";. But how would I convert the $number varible into a rounded number, so that when I say echo "$number";
Help with Hyperlink
Hi,What I am trying to do may be simple, I just can't get it to work. Ok...I am using Zend and so the database connect that I need for this is a simple call to it like Code:
Uploading files/images via forms
Hey all, I am building a database for work that will contain some minor data on plant species along with 4 images. I have developed the form and am able to add the data but due to my abilities and I
OOP help
okay so i have a class im making it has everything setup i just need to randomize the 2 variables and return which variable that was randomized and output it.Code: <?phpclass hit_chance {
Basic Forum Tutorial
Hi, I'm new to PHP. I want to build a basic forum for my site using PHP and MySQL. I've searched the 'net, but every tutorial I found the writer seems to get 'too technical' after a few steps. I