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 3234648
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:24:57+00:00 2026-05-17T17:24:57+00:00

CREATE TABLE IF NOT EXISTS `Channels` ( `id` int(11) NOT NULL AUTO_INCREMENT, `name` varchar(30)

  • 0
    CREATE TABLE IF NOT EXISTS `Channels` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `name` varchar(30) NOT NULL,
  `commercial` tinyint(1) NOT NULL DEFAULT '0',
  `usrid` int(11) NOT NULL DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=MyISAM  DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;


INSERT INTO `Channels` (`id`, `name`, `commercial`, `usrid`) VALUES
(2, 'ORF 1', 0, 0);

PHP:

<?php
  if (isset($_POST['name'])){
    mysql_connect("localhost", "test", "test") or die(mysql_error());
    mysql_select_db("test") or die(mysql_error());
    $tmp = mysql_query("SELECT commercial 
                          FROM Channels 
                         WHERE name='".mysql_real_escape_string($_POST['name'])."'");
    $row = mysql_fetch_row($tmp);
    echo $row['commercial'];
  }
  else
  {
    ?>
    <form method="post" action="<?php echo $_SERVER['PHP_SELF'];?>">
      <input name="name" type="text">
      <input type="submit" name="submit" value="submit" >
    </form>
    <?php
  }
?>

There is no output when I submit “ORF 1”.

  • 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-05-17T17:24:58+00:00Added an answer on May 17, 2026 at 5:24 pm

    It’s vital that you learn to employ basic debugging techniques:

    Instead of this:

    $tmp = mysql_query("SELECT commercial FROM Channels WHERE 
        name='".mysql_real_escape_string($_POST['name'])."'");
    $row = mysql_fetch_row($tmp);
    echo $row['commercial'];
    

    do this:

    $tmp = mysql_query("SELECT commercial FROM Channels WHERE 
        name='".mysql_real_escape_string($_POST['name'])."'");
    
    // Make sure the query was successful
    if (false === $tmp) {
       die("Query failed: " . mysql_error());
    }
    
    $row = mysql_fetch_row($tmp);
    
    // Don't assume a row was returned
    var_dump($row);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Here's my table: CREATE TABLE `alums_alumphoto` ( `id` int(11) NOT NULL auto_increment, `alum_id` int(11)
CREATE TABLE IF NOT EXISTS XY ( x INT NOT NULL , y FLOAT
Using the command: CREATE TABLE IF NOT EXISTS `test`.`t1` ( `col` VARCHAR(16) NOT NULL
Given a table such as: CREATE TABLE dbo.MyTestData (testdata varchar(50) NOT NULL) ALTER TABLE
I have the following table structure CREATE TABLE `table` ( `id` int(11) NOT NULL
Simplified Table structure: CREATE TABLE IF NOT EXISTS `hpa` ( `id` bigint(15) NOT NULL
string createTable = CREATE TABLE IF NOT EXISTS + m_strDatabase + _TimeLogs (logName VARCHAR(16),
My table is as follows: CREATE TABLE IF NOT EXISTS PHONES ( number VARCHAR(10),
i have 2 tables CREATE TABLE if not exists tag_name( + tagid INTEGER PRIMARY
I have this table: CREATE TABLE IF NOT EXISTS `events` ( `evt_id` int(11) NOT

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.