This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#26 2011-10-01 03:25:06

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: SQL Help

GP1 wrote:

I think it has to be an IOS.

Ok, anyway, can you fix the login glitch on the website, and fix up the font and style of each page a bit more? It is getting messy. Leave the navigation where it is, or you can out it horizontally if you can, thanks!


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#27 2011-10-01 03:30:20

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: SQL Help

Try this, but look near the bottom where the comment is and change according to the database rows.

Code:

<link rel="stylesheet" type="text/css" href="global.css" />
<?php

$dbHost = '*'; // localhost will be used in most cases
// set these to your mysql database username and password.
$dbUser = '*'; 
$dbPass = '*';
$dbDatabase = '*'; // the database you put the table into.
$con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error());

mysql_select_db($dbDatabase) or trigger_error("Failed to connect to database. Error: " . mysql_error());

// Set up our error check and result check array
$error = array();
$results = array();

// First check if a form was submitted. 
// Since this is a search we will use $_GET

$query="SELECT * FROM messages";
$result=mysql_query($query);
while($row=mysql_fetch_array($result){
//***************put code to execute for every row here, like:
echo $row['username'];
echo $row['messageContent'];
}
?>

I am currently http://blocks.scratchr.org/API.php?user=GP1&amp;action=onlineStatus&amp;type=imagehttp://blocks.scratchr.org/API.php?user=GP1&amp;action=onlineStatus&amp;type=text and I finally got over 1000 posts.

Offline

 

#28 2011-10-01 03:39:46

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: SQL Help

GP1 wrote:

Try this, but look near the bottom where the comment is and change according to the database rows.

Code:

<link rel="stylesheet" type="text/css" href="global.css" />
<?php

$dbHost = '*'; // localhost will be used in most cases
// set these to your mysql database username and password.
$dbUser = '*'; 
$dbPass = '*';
$dbDatabase = '*'; // the database you put the table into.
$con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error());

mysql_select_db($dbDatabase) or trigger_error("Failed to connect to database. Error: " . mysql_error());

// Set up our error check and result check array
$error = array();
$results = array();

// First check if a form was submitted. 
// Since this is a search we will use $_GET

$query="SELECT * FROM messages";
$result=mysql_query($query);
while($row=mysql_fetch_array($result){
//***************put code to execute for every row here, like:
echo $row['username'];
echo $row['messageContent'];
}
?>

Thanks, but it says "unexpected { at line 23"


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#29 2011-10-01 03:41:55

GP1
Scratcher
Registered: 2009-07-06
Posts: 1000+

Re: SQL Help

WindowsExplorer wrote:

GP1 wrote:

Try this, but look near the bottom where the comment is and change according to the database rows.

Code:

<link rel="stylesheet" type="text/css" href="global.css" />
<?php

$dbHost = '*'; // localhost will be used in most cases
// set these to your mysql database username and password.
$dbUser = '*'; 
$dbPass = '*';
$dbDatabase = '*'; // the database you put the table into.
$con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error());

mysql_select_db($dbDatabase) or trigger_error("Failed to connect to database. Error: " . mysql_error());

// Set up our error check and result check array
$error = array();
$results = array();

// First check if a form was submitted. 
// Since this is a search we will use $_GET

$query="SELECT * FROM messages";
$result=mysql_query($query);
while($row=mysql_fetch_array($result){
//***************put code to execute for every row here, like:
echo $row['username'];
echo $row['messageContent'];
}
?>

Thanks, but it says "unexpected { at line 23"

Whoops, I forgot an extra ) this is right

Code:

Code:

<link rel="stylesheet" type="text/css" href="global.css" />
<?php

$dbHost = '*'; // localhost will be used in most cases
// set these to your mysql database username and password.
$dbUser = '*'; 
$dbPass = '*';
$dbDatabase = '*'; // the database you put the table into.
$con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error());

mysql_select_db($dbDatabase) or trigger_error("Failed to connect to database. Error: " . mysql_error());

// Set up our error check and result check array
$error = array();
$results = array();

// First check if a form was submitted. 
// Since this is a search we will use $_GET

$query="SELECT * FROM messages";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
//***************put code to execute for every row here, like:
echo $row['username'];
echo $row['messageContent'];
}
?>

I am currently http://blocks.scratchr.org/API.php?user=GP1&amp;action=onlineStatus&amp;type=imagehttp://blocks.scratchr.org/API.php?user=GP1&amp;action=onlineStatus&amp;type=text and I finally got over 1000 posts.

Offline

 

#30 2011-10-01 03:49:57

WindowsExplorer
Scratcher
Registered: 2011-02-25
Posts: 1000+

Re: SQL Help

GP1 wrote:

WindowsExplorer wrote:

GP1 wrote:

Try this, but look near the bottom where the comment is and change according to the database rows.

Code:

<link rel="stylesheet" type="text/css" href="global.css" />
<?php

$dbHost = '*'; // localhost will be used in most cases
// set these to your mysql database username and password.
$dbUser = '*'; 
$dbPass = '*';
$dbDatabase = '*'; // the database you put the table into.
$con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error());

mysql_select_db($dbDatabase) or trigger_error("Failed to connect to database. Error: " . mysql_error());

// Set up our error check and result check array
$error = array();
$results = array();

// First check if a form was submitted. 
// Since this is a search we will use $_GET

$query="SELECT * FROM messages";
$result=mysql_query($query);
while($row=mysql_fetch_array($result){
//***************put code to execute for every row here, like:
echo $row['username'];
echo $row['messageContent'];
}
?>

Thanks, but it says "unexpected { at line 23"

Whoops, I forgot an extra ) this is right

Code:

Code:

<link rel="stylesheet" type="text/css" href="global.css" />
<?php

$dbHost = '*'; // localhost will be used in most cases
// set these to your mysql database username and password.
$dbUser = '*'; 
$dbPass = '*';
$dbDatabase = '*'; // the database you put the table into.
$con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error());

mysql_select_db($dbDatabase) or trigger_error("Failed to connect to database. Error: " . mysql_error());

// Set up our error check and result check array
$error = array();
$results = array();

// First check if a form was submitted. 
// Since this is a search we will use $_GET

$query="SELECT * FROM messages";
$result=mysql_query($query);
while($row=mysql_fetch_array($result)){
//***************put code to execute for every row here, like:
echo $row['username'];
echo $row['messageContent'];
}
?>

Thank you! Now it works perfectly  smile


http://i.imgur.com/H6LLdnK.pnghttp://i.imgur.com/VYuD7BY.png

Offline

 

#31 2012-03-24 19:26:57

GeonoTRON2000
Scratcher
Registered: 2009-12-24
Posts: 1000+

Re: SQL Help

I know what you did wrong.
Edits marked in green.

<link rel="stylesheet" type="text/css" href="global.css" />
<?php

$dbHost = '*'; // localhost will be used in most cases
// set these to your mysql database username and password.
$dbUser = '*';
$dbPass = '*';
$dbDatabase = '*'; // the database you put the table into.
$con = mysql_connect($dbHost, $dbUser, $dbPass) or trigger_error("Failed to connect to MySQL Server. Error: " . mysql_error());

mysql_select_db($dbDatabase, $con) or trigger_error("Failed to connect to database. Error: " . mysql_error());

// Set up our error check and result check array
$error = array();
$results = array();

// First check if a form was submitted.
// Since this is a search we will use $_GET

$query="SELECT * FROM messages";
$result=mysql_query($query, $con);
echo "$result";
?>


http://i.imgur.com/BAEgGDL.png

Offline

 

Board footer