Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8140163
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T12:04:09+00:00 2026-06-06T12:04:09+00:00

I’m sure this is pretty elementary but I’m new to php. Can someone tell

  • 0

I’m sure this is pretty elementary but I’m new to php. Can someone tell me why this code won’t write to the table? I just simply want the form to update a table in the db. Everthing works except the data in the table is not being overwritten. Any help would be greatly appreciated! Thanks.

<?php
$username="username";
$password="password";
$dbname="database";
$usertable="table";
$connect = @mysql_connect($hostname, $username, $password)or die
("cannot connect to db");
mysql_select_db($dbname);

$show=$_POST['show'];
$pro=$_POST['pro'];
$twmo=$_POST['twmo'];


mysql_query("INSERT INTO $usertable VALUES
('$show','pro','$twmo')" );

mysql_close($connect);
header("Location: http://www.myhomepage.com");

?>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T12:04:11+00:00Added an answer on June 6, 2026 at 12:04 pm

    First,

    • Your code is vulnerable to SQL injections.
      A malicious user could easily wipe out your entire table.
    • You shouldn’t even be using mysql_*!
      It’s deprecated and bad style! Go find a tutorial for mysqli or PDO, don’t relay on articles from 2008.

    Regarding the actual question, try some debugging yourself. You’re not checking if any of your queries succeed. When you perform a query, mysql_query() returns either a resource or FALSE on failure. Check if this is happening, so you can find out where exactly the error is happening and what it is using mysql_error().

    If your table is actually called table, then that’s the problem. table is a reserved keyword. You could fix it by encapsulating it with ticks `, but really you should just change its name. It isn’t useful at all to have a table named table. Call it what it contains.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want to count how many characters a certain string has in PHP, but
this is what i have right now Drawing an RSS feed into the php,
I have this code to decode numeric html entities to the UTF8 equivalent character.
This could be a duplicate question, but I have no idea what search terms
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString
Does anyone know how can I replace this 2 symbol below from the string
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.