Go Back   Web User Forums > All Other Technical Help Topics > Web design & build

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 12-08-18, 19:26
TheClash TheClash is offline
Enthusiastic contributor
 
Join Date: Sep 2015
Posts: 260
Exclamation connectign to mysql

as my web host and others don't allow tickets anymore I hope somebody can solve this. I i have one bit of code working but another not. I cant see the diferance.


Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /homepages/34/d747981205/htdocs/SQL/insert.php:21 Stack trace: #0 {main} thrown in /homepages/34/d747981205/htdocs/SQL/insert.php on line 21


<?php
Line 21 is:-----
$con = mysql_connect("db749575X.db.1and1.com","dbo749575X ","passwordforDB");

if (!$con)

{

die('Could not connect: ' . mysql_error());

}



YET THIS WORKS:--

$mysqli_host="db749575322.db.1and1.com";
$mysqli_user="dbo749575X";
$mysqli_password="PASS";
$my_database = "db749575X";
$table_name = "wp_jmpp_options";

/*Please Do not change anything below this line */

$link = mysqli_connect("$mysqli_host", "$mysqli_user", "$mysqli_password", "$my_database")
or die("Could not connect : " . mysqli_error($link));
echo "Connected successfully";
mysqli_select_db($link, "$my_database") or die("Could not select database");

/* Performing SQL query */
$query = "SELECT * FROM $table_name LIMIT 3";
$result = mysqli_query($link, $query) or die("Query failed, but please ignore the error message : " . mysqli_error($link));
Reply With Quote
Reply

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Search the forum

Search

© Dennis Publishing Limited Licensed by Felden





All times are GMT. The time now is 04:56.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
Copyright Dennis Publishing 2010, All rights reserved