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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T23:24:44+00:00 2026-06-02T23:24:44+00:00

My PHP script is as follows: <?php require_once(‘connectvars.php’); $file = $_FILES[‘image’][‘name’]; $target = GW_UPLOADPATH

  • 0

My PHP script is as follows:

<?php

require_once('connectvars.php');

$file = $_FILES['image']['name'];
$target = GW_UPLOADPATH . $file;

if (move_uploaded_file($_FILES['image']['tmp_name'], $target)) {
    $dbc = mysqli_connect(DB_HOST, DB_UN, DB_PW, DB_NAME) or die('Error connecting to the MySQL server');

    $title = mysqli_real_escape_string($dbc, trim($_POST['title']));
    $description = mysqli_real_escape_string($dbc, trim($_POST['content']));
    $host = mysqli_real_escape_string($dbc, trim($_POST['host']));
    $duration = mysqli_real_escape_string($dbc, trim($_POST['duration']));
    $sn1 = mysqli_real_escape_string($dbc, trim($_POST['link1']));
    $sn2 = mysqli_real_escape_string($dbc, trim($_POST['link2']));
    $sn3 = mysqli_real_escape_string($dbc, trim($_POST['link3']));
    $sn4 = mysqli_real_escape_string($dbc, trim($_POST['link4']));
    $sn5 = mysqli_real_escape_string($dbc, trim($_POST['link5']));

    $query = "INSERT INTO dyhamb (title, description, host, duration, file, sn1, sn2, sn3, sn4, sn5 ) VALUES ('$title', '$description', '$host', '$duration', '$file', '$sn1', '$sn2', '$sn3', '$sn4', '$sn5')";
    $result = mysqli_query($dbc, $query);

    if (!$result) {
        echo 'failed';
    } else {
        echo 'success';
    }

    mysqli_close($dbc);
}
?>

When I run the script I am getting ‘failed’ returned and I cannot work out why. Both $dbc and $query appear to be fine, therefore not sure why $result isn’t defined.

  • 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-02T23:24:47+00:00Added an answer on June 2, 2026 at 11:24 pm
    if ($result === FALSE) {
        echo mysqli_error($dbc);
    } else {
        echo mysqli_affected_rows($dbc);
    }
    

    Also

    $ mysql -u root -pmyPassWord DB_NAME

    > select title from dynamb;

    Verify that something is actually getting into the database.

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

Sidebar

Related Questions

Now my channel.html file looks as follows: <?php require_once __DIR__ . '/ay/includes/config.inc.php'; session_set_cookie_params(7200, '/'
I have a php script to create jpg thumbnail of pdf as follows; <?php
I have a PHP script that executes a .bat file using system(cmd /c C:\dir\file.bat);
Consider a PHP script that outputs all POST data, as follows: <?php var_dump($_POST); ?>
My php script is as follows: if (!empty($_POST['action'])){ PutEnv(TNS_ADMIN='C:\\Programy\\OracleDeveloper10g\\NETWORK\\ADMIN\\'); $conn = oci_connect('s14', 'sm19881', 'umain');
I am trying to write a php script that take a text file break
I am working on a PHP script that automatically displays an image based on
I have the php script as follows : $sql = SELECT * FROM tbl_messages
My PHP script generates a table with rows which can optionaly be edited or
A php script is giving this array (which has been passed through json_encode() )

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.