Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 1:25 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
 Post subject: using databases online tutorial not working
PostPosted: February 16th, 2016, 8:10 am 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
In the tutorial on Opus' website on "Using databases online" where you use the Post web data, I followed every step (I think) accurately, but it won't work. I tested the code to see if it is a database connectivity problem by substituting the

$first = $_POST['first'];

with

$first = "first";

and then it writes to the database, but whenever I use the "Post" tag nothing happens.

Attach is my code....Can't attach screenshot of opus because "Sorry, the board attachment quota has been reached."...Well done Opus.

<?php

$first = $_POST['first'];
$last = $_POST['last'];
$address = $_POST'address'];
$position = $_POST['position'];

$DBhost = "localhost";
$DBuser = "_______user";
$DBpass = "_______";
$DBName = "qxeacpqg_myDB";


$connect = mysql_connect($DBhost,$DBuser,$DBpass);
$db = mysql_select_db($DBName,$connect);
$query = "INSERT INTO clients (first, last, address, position)
VALUES ('$first','$last','$address','$position')";
$result = mysql_query($query, $connect);



?>


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 16th, 2016, 9:46 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
This belongs in advanced I think.

What is the URL of the HTML file?

What is the URL of the PHP file?

What is the URL used in the POST request?

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 16th, 2016, 9:53 am 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
Hi Mack, thank you for your responce.

URL for html : http://www.cbt44.com/Homepage (3).htm

URL for PHP : http://www.cbt44.com/insert.php


URL used in the POST request (I take it you mean the URL in the Post Web Data tab) : http://www.cbt44.com/insert.php


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 16th, 2016, 10:04 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
Is the insert.php file there at the moment? It's returning a server error and 0kb size?

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 16th, 2016, 10:10 am 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
Yes, it is in my public_html folder where the rest of my files is.

Size 504kb


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 16th, 2016, 10:55 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
What file permissions are set the file?

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 16th, 2016, 10:59 am 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
How can I find where the file permissions are...when i right click and under permissions no boxes are ticked under owner, group, all users


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 16th, 2016, 11:27 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
I believe, all of them should have Read (R) ticked and Owner should have Write (W) ticked giving a value of 0644.

Also check the parent folder and see what are ticked there.

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 16th, 2016, 11:43 am 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
Okay I did as you requested.

I also find an error_log file in the parent folder:

[16-Feb-2016 07:20:59 UTC] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/qxeacpqg/public_html/insert.php on line 14
[16-Feb-2016 07:22:30 UTC] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/qxeacpqg/public_html/insert.php on line 14
[16-Feb-2016 07:22:31 UTC] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/qxeacpqg/public_html/insert.php on line 14
[16-Feb-2016 07:22:32 UTC] PHP Deprecated: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead in /home/qxeacpqg/public_html/insert.php on line 14
[16-Feb-2016 07:24:11 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 08:10:13 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 08:21:45 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 08:48:39 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 08:49:50 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 08:51:21 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 08:57:38 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 08:59:15 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 08:59:46 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 09:47:25 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 09:48:03 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 09:48:24 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 09:49:54 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5
[16-Feb-2016 09:54:39 UTC] PHP Parse error: syntax error, unexpected ''address'' (T_CONSTANT_ENCAPSED_STRING) in /home/qxeacpqg/public_html/insert.php on line 5


What does this mean


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 16th, 2016, 11:55 am 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
Thanks Mack and I apologize for wasting your time, I left [ out.


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 16th, 2016, 11:57 am 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
The first error is because the SQL you're using old method and will eventually not be supported. I've already answered this questions elsewhere.

The second error is likely to do with the address line as you're missing an opening square bracket.

</mack>

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 17th, 2016, 2:42 pm 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
Hi Mack,

I really apologise for taking your time...but I went through all your other old posts on this matter with no success. But I am trying now to pull records from the database to the website, but nothing works.

The PHP Script for http://www.cbt44.com/insert_2.php is:

Code:
<?php

$DBhost = "localhost";
$DBuser = "I am a spammer";
$DBpass = "I am a spammer";
$DBName = "qxeacpqg_myDB";



$connect = mysql_connect($DBhost,$DBuser,$DBpass);
$db = mysql_select_db($DBName,$connect);
$query = "SELECT * FROM clients";
$result = mysql_query($query, $connect);



$row = mysql_fetch_array($result);
$data = "&var1=".$row['first']."&var2=".$row['last']."&var3=".$row['address']."&var4=".$row['position'];
echo $data;

?>

and displays the following: &var1=first&var2=first&var3=first&var4=first

but on http://www.cbt44.com/data.htm that was published by Opus, nothing is displayed???


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: using databases online tutorial not working
PostPosted: February 17th, 2016, 3:40 pm 
Offline

Joined: May 12th, 2015, 2:04 pm
Posts: 47
Opus: Opus 9.5
OS: Win 8
System: Intel Core i7 3.6Ghz
Never Mind


For this message Matra has been thanked by : mackavi


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group