Jump to content

Search the Community

Showing results for tags 'php sql'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to PHP Freaks
    • Announcements
    • Introductions
  • PHP Coding
    • PHP Coding Help
    • Regex Help
    • Third Party Scripts
    • FAQ/Code Snippet Repository
  • SQL / Database
    • MySQL Help
    • PostgreSQL
    • Microsoft SQL - MSSQL
    • Other RDBMS and SQL dialects
  • Client Side
    • HTML Help
    • CSS Help
    • Javascript Help
    • Other
  • Applications and Frameworks
    • Applications
    • Frameworks
    • Other Libraries
  • Web Server Administration
    • PHP Installation and Configuration
    • Linux
    • Apache HTTP Server
    • Microsoft IIS
    • Other Web Server Software
  • Other
    • Application Design
    • Other Programming Languages
    • Editor Help (PhpStorm, VS Code, etc)
    • Website Critique
    • Beta Test Your Stuff!
  • Freelance, Contracts, Employment, etc.
    • Services Offered
    • Job Offerings
  • General Discussion
    • PHPFreaks.com Website Feedback
    • Miscellaneous

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


AIM


MSN


Website URL


ICQ


Yahoo


Jabber


Skype


Location


Interests


Age


Donation Link

Found 5 results

  1. <?php include 'core/classes/Query.php'; include 'core/functions/recaptchalib.php'; $sqlQ = "SELECT * FROM `servers`"; $qResult = $database->query($sqlQ); $i = 0; while ($row = $qResult->fetch_assoc()) { $query = new Query($row['address'], $row['query_port'], $row['engine']); $info = $query->query(); if(!$info) { $info = $query->return_false(); } $details = array( 'players' => $info['players'], 'details' => $info['details'] ); $details = json_encode($details); $update = $database->prepare("UPDATE `servers` SET `status` = ?, `online_players` = ?, `maximum_online_players` = ?, `map` = ?, `details` = ?, `cachetime` = unix_timestamp() WHERE `server_id` = {$row['server_id']}" $update->bind_param('sssss', $query->status, $info['general']['online_players']['value'], $info['general']['maximum_online_players']['value'], $info['general']['map']['value'], $details) $update->execute(); } ?> What I'm trying to accomplish is query every server & update every one of the rows for each server listed. This does nothing ( its a cronjob , as it has to run every 5 minutes , newbie so not entirely sure if this is event the right approach )
  2. I have been looking at this code most of the morning and do not have a clue what is wrong with the code. I am hoping its not a stupid mistake, can someone please help me out? thank you <title>Inputing Travel Detials</title> <header> <h1 align="center"> Adding Travel Detials </h1> <body> <p> <center><img src="cyberwarfareimage1.png" alt="Squadron logo" style="width:200px;height:200px" style="middle"></center> <table border="1"> <tr> <td><a href="index.php"> Home Page </a></td> <td><a href="administratorhomepage.html">Administrator Home Page </a></td> <td><a href="viewhomepage.html">View Home Page </a></td> <td><a href="Inputhomepage.html">Input Home Page </a></td> <td><a href="traveldetials.html">Enter More Travel Detials </a></td> </table> </p> <?php include "connection.php"; $Applicant_ID = $_POST["Applicant_ID"]; $Method_Of_Travel = $_POST["Method_Of_Travel"]; $Cost = $_POST["Cost"]; $ETA = $_POST["ETA"]; $Main_Gate_Advised = $_POST["Main_Gate_Advised"]; $query = ("UPDATE `int_board_applicant` SET `Method_Of_Travel`=`$Method_Of_Travel', `Cost`=`$Cost', `ETA`='$ETA', `Main_Gate_Advised`='$Main_Gate_Advised' WHERE `Applicant_ID`='$Applicant_ID'"); $result = mysqli_query($dbhandle, $query) or die(mysqli_error($dbhandle)); if($result){ echo "Success!"; } else{ echo "Error."; } // successfully insert data into database, displays message "Successful". if($query){ echo "Successful"; } else { echo "Data not Submitted"; } //closing the connection mysqli_close($dbhandle) ?>
  3. coding below is not working for selecting data from mysql ______________________________________________ <?php $name=$_REQUEST['name']; $password=$_REQUEST['password']; $connect=mysql_connect('localhost','root','') or die("Error to Connect Database"); if ($connect) { mysql_select_db('dental',$connect) or die("Error in DB Select"); $qury="select * from admin where name=$name"; $run=mysql_query($qury, $connect) or die("error in sql query"); $count=mysql_num_rows($run) or die ("error in rows"); if ($count == 1) { $rows=mysql_fetch_assoc($runQury); if ($rows['password'] == $password) { header("location:adminarea.php"); } else { header("location:welcome.php"); } } else { } } ?>
  4. I'm trying to embed a sql query into my php on my html page. I keep getting the error mysql_fetch_array() expects parameter 1 to be resource, boolean is given. What am I doing wrong? (Please note I'm not well versed in PHP and need specific directions on how to change my code) <?php require_once('auth.php'); ?> <html> <!-- This is the stub page for tying in your final project database into the website --> <!-- Don't forget to add premissions to your final project database so that your user can access it --> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Final Project</title> </head> <body> <h1>Final project page <?php echo $_SESSION['SESS_FIRST_NAME'];?></h1> <p>This is where you will link in your final project database</p></br> <p>Good luck!</p></br> <div id="innerWrapper"> <!--start of sql embedding --> <a href="index.php">Login Page</a> | <a href="amenu.php">Menu Page</a> | <a href="logout.php">Logout</a> <h2>Customer Contact Info:</h2> <?php //Verified passwords $vlogin=$_SESSION['vlogin']; $vpassword=$_SESSION['vpasswd']; //This is the connection string for the database, server, username and password $con = mysql_connect("localhost",$vlogin,$vpassword); //CASE SENSITIVE if (!$con) { die('Could not connect: ' . mysql_error()); } //This is the connection string for the database, server, username and password $con = mysql_connect("localhost",$vlogin,$vpassword); //CASE SENSITIVE if (!$con) { die('Could not connect: ' . mysql_error()); } // Actually using the connection string and connecting to the database like the 'use' command mysql_select_db("finalprojectdb", $con); //The actual SQL code that will return a table structure into the local variable $result //Important note, PHP variables are case sensitive $result = mysql_query("SELECT Cust_Num, Contact_Name, Contact_Phone from Customer order by Cust_Num"); //constructing the table and column names //ECHO allows HTML to go through PHP to the server echo "<table border=''> <tr> <th>Customer Number</th> <th>Contact Name</th> <th>Contact Phone</th> </tr>"; // Looping until there are no more records from $result //If there are records, print the colum for that row //also ECHO allows HTML to pass through PHP while($row = mysql_fetch_array($result)) { echo "<tr>"; echo "<td>" . $row['CUST_NUM'] . "</td>"; echo "<td>" . $row['CONTACT_NAME'] . "</td>"; echo "<td>" . $row['CONTACT_PHONE'] . "</td>"; echo "</tr>"; } echo "</table>"; //Closing the SQL connection string mysql_close($con); ?> </div> <div> [<a href="aMenu.php">Return to home page</a>] </div> </body> </html>
  5. I have a little over one million rows of data that I want to insert into a mysql database and I need some help with the correct code for sql in PHP to do this Please. I can get my data with this but how would I convert the echo to an SQL Insert statment $file = fopen("data.txt", "r") or exit("Fail!"); while(!feof($file)){ $string = fgets($file); $array = explode('|',$string); echo $array[0]." - ".$array[1]." - ".$array[4]." - ".$array[5]." - ".$array[6]." - ".$array[7]." - ".$array[8]." - ".$array[9]." - ".$array[10]." - ".$array[15]." - ".$array[16]." - ".$array[17]." - ".$array[18]." - ".$array[21]." - ".$array[22]." - ".$array[23]." "; } fclose($file); ?> iNSERT INTO publicEN( unique_system_identifiern, uls_file_number, ebf_number, call_sign, entity_type, licensee_id, entity_name, first_name, mi, last_name, suffix, phone, fax, email, street_address, city, state, zip_code, po_box, attention_line, sgin, frn, applicant_type_code, applicant_type_other, status_code, status_date) VALUES ($array[0],$array[1],$array[4],$array[5],$array[6],$array[7],$array[8],$array[9],$array[10],$array[15],$array[16],$array[17],$array[18],$array[21],$array[22],$array[23])
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.