Previous Thread
Next Thread
Print Thread
Rate Thread
Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
Well, after scouring the internet for a whole of 30 minutes, I decided that nothing out there was exactly what i needed. So I snagged a few tut's and began working...

I fixed up the db i need through phpmyadmin (god bless the gui on that [censored])... See code below:
Code
CREATE TABLE `ugn_applications` (
  `id` int(11) NOT NULL auto_increment,
  `name` varchar(20) NOT NULL default '',
  `nick` varchar(20) NOT NULL default '',
  `email` varchar(50) NOT NULL default '',
  `yob` varchar(4) NOT NULL default '',
  `telephone` varchar(20) NOT NULL default '',
  `address` varchar(100) NOT NULL default '',
  `sections` varchar(100) NOT NULL default '',
  `aim` varchar(20) NOT NULL default '',
  `irc` varchar(20) NOT NULL default '',
  `bbs` varchar(20) NOT NULL default '',
  `moderate` varchar(10) NOT NULL default '',
  `admin` varchar(10) NOT NULL default '',
  `news` varchar(10) NOT NULL default '',
  `other` varchar(10) NOT NULL default '',
  `username` varchar(20) NOT NULL default '',
  `password` varchar(20) NOT NULL default '',
  `comments` varchar(255) NOT NULL default '',
  `country` varchar(20) NOT NULL default '',
  `ip` varchar(15) NOT NULL default '',
  `status` varchar(20) NOT NULL default '',
  PRIMARY KEY  (`id`)
) TYPE=MyISAM AUTO_INCREMENT=2 ;
Upon creating the forum to list data (I made a result first) all i get is "Error on line 20"... Anyone care to take a look?:

Code
<?php
// Change below to your MySQL Host.
$host = "127.0.0.1";

// change below is your assigned mySQL username
$user = "[username]";

// change to the pw below is your assigned mySQL password
$pw = "[password]";

// change to the database you have permission to connect to
$db = "[databasename]";

$mysql_access = mysql_connect("$host", $user, $pw);
?>

<?php
$query = "SELECT * FROM ugn_applications";
$result = mysql_query($query, $mysql_access);
if(mysql_num_rows($result)) {
    // it is true, so let's print the results to the browser
   while($row = mysql_fetch_row($result))
  {
      print("$row[0]
");
  }
} else {
   // false, no results
}
?>

<?
mysql_close($mysql_access);
?>
The section that seems to be giving me the error is:
Code
if(mysql_num_rows($result)) {
    // it is true, so let's print the results to the browser
   while($row = mysql_fetch_row($result))
  {
      print("$row[0]
");
  }
} else {
   // false, no results
}
Do we finally have any knowlegable php/mysql guys here, or do I need to just go shoot myself in the foot?


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Aug 2002
Posts: 68
S
Junior Member
Offline
Junior Member
S
Joined: Aug 2002
Posts: 68
Code
<?php
// Change below to your MySQL Host.
$host = "127.0.0.1";

// change below is your assigned mySQL username
$user = "[username]";

// change to the pw below is your assigned mySQL password
$pw = "[password]";

// change to the database you have permission to connect to
$db = "[databasename]";

$mysql_access = mysql_connect($host, $user, $pw) or die(mysql_error());
mysql_select_db($db) or die(mysql_error()); // make sure you add this ;)
?>

<?php
$query = "SELECT * FROM ugn_applications";
$result = mysql_query($query, $mysql_access) or die(mysql_error());
if(mysql_num_rows($result)>0) { // if we have results
	while($result2 = mysql_fetch_array($result)) { 
		echo $row[0]."
\n";
		// or you can do echo "{$row[0]}
\n";
		// tag the \n on for readable html ;)
	}
}
?>
<!-- I presume you have html code here -->
<?
	mysql_close($mysql_access);
	// I usually don't mysql_close, at the end of PHP processing the script all mysql
	// connections are killed unless they're persistant
?>
// notice that I added "or die(mysql_error()); " to all the main SQL functions? 
// this can pinpoint the problem &  will print out an error straight from mysql
// don't put these in final versions though, make your own error msg else you'll
// be giving away free information about your query structure & db structure 
// to hackers trying SQL inject attacks.

Joined: Aug 2002
Posts: 68
S
Junior Member
Offline
Junior Member
S
Joined: Aug 2002
Posts: 68
change $rows to $result2

Joined: Dec 2002
Posts: 3,255
Likes: 3
UGN Elite
Offline
UGN Elite
Joined: Dec 2002
Posts: 3,255
Likes: 3
A few changes I would make.

Code
<?php

$host = "localhost";

$user = "[username]";

$pw = "[password]";

// change to the database you have permission to connect to
$db = "[databasename]";
	
$db = "bflfrq8";

//Why use variables, save on some lines of code.  You can add a auth scriptlet to this later to make sure they are supposed to be here.

mysql_connect($host, $user, $pw)or die(mysql_error());

mysql_select_db($db) or die(mysql_error()); 
$result = mysql_query("SELECT * FROM ugn_applications") or die(mysql_error());
if(mysql_num_rows($result)>0) { // if we have results
	while($result2 = mysql_fetch_array($result)) { 
		echo $result2[0]."
\n";
		// or you can do echo "".$result2[0]."
\n";
		// tag the \n on for readable html ;)
	}
}
?>
<!-- I presume you have html code here -->
<?
	mysql_close($mysql_access);
	// I usually don't mysql_close, at the end of PHP processing the script all mysql
	// connections are killed unless they're persistant
?>
// notice that I added "or die(mysql_error()); " to all the main SQL functions? 
// this can pinpoint the problem &  will print out an error straight from mysql
// don't put these in final versions though, make your own error msg else you'll
// be giving away free information about your query structure & db structure 
// to hackers trying SQL inject attacks.

Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
Need to work on an input script, anyone wanna help? I don't know this [censored]! lol`


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Aug 2002
Posts: 68
S
Junior Member
Offline
Junior Member
S
Joined: Aug 2002
Posts: 68
If you pay me I'll do it. You know my sn.

Joined: Dec 2003
Posts: 17
Junior Member
Offline
Junior Member
Joined: Dec 2003
Posts: 17
As will I, but cheaper wink

Joined: Dec 2002
Posts: 3,255
Likes: 3
UGN Elite
Offline
UGN Elite
Joined: Dec 2002
Posts: 3,255
Likes: 3
Ahh [censored] guys, gizzy is having trouble as is with the money on this place.

email me the specs gizmo...

Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
Lol, money, that's funny... :watches months fly out of wallet:


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Dec 2002
Posts: 3,255
Likes: 3
UGN Elite
Offline
UGN Elite
Joined: Dec 2002
Posts: 3,255
Likes: 3
Check your P/M's the frame work is done.

Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
Guess I should have said when Neo, Scallion and I hammered out the front end... lol... I have some code for you to look at later though, I'll email it to you heh...


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner
Joined: Sep 2002
Posts: 390
UGN Member
Offline
UGN Member
Joined: Sep 2002
Posts: 390
I would help! But I AM A NINJA!!!!!!!


"The secret to creativity is knowing how to hide your sources."
-Albert Einstein

Tech Ninja Security
Joined: Dec 2002
Posts: 3,255
Likes: 3
UGN Elite
Offline
UGN Elite
Joined: Dec 2002
Posts: 3,255
Likes: 3
Still waiting on that email Gizzy...

Joined: Feb 2002
Posts: 7,203
Likes: 11
Community Owner
OP Offline
Community Owner
Joined: Feb 2002
Posts: 7,203
Likes: 11
check your pm's, i'll get it off to you in a sec..


Donate to UGN Security here.
UGN Security, Back of the Web, and VNC Web Services Owner

Link Copied to Clipboard
Member Spotlight
Phatal
Phatal
Houston, TX
Posts: 298
Joined: April 2004
Forum Statistics
Forums41
Topics33,840
Posts68,858
Average Daily Posts1
Members2,176
Most Online3,253
Jan 13th, 2020
Latest Postings
Where and how do you torrent?
by danni75 - 03/01/24 05:58 AM
Animation,
by JohanKaariainen - 08/15/19 01:18 AM
Blackbeard.....
by Gremelin - 10/03/18 07:02 PM
my old account still exists!
by Crime - 08/10/18 02:47 PM
Okay WTF?
by HenryMiring - 09/27/17 01:45 AM
The History Thread...
by Gremelin - 08/11/17 12:11 PM
My friend NEEDS your HELP!
by Lena01 - 07/21/17 12:06 AM
I'm having fun with this guy.
by gabithompson730 - 07/20/17 01:50 AM
I want to upgrade my phone
by gabithompson730 - 07/20/17 01:49 AM
Doom 3
by Cyrez - 09/11/14 08:58 PM
Amazon Gift Card Generator/KeyGen?te
by Gecko666 - 08/22/14 09:21 AM
AIM scene 99-03
by lavos - 09/02/13 08:06 AM
Planetside 2
by Crime - 03/04/13 07:10 AM
Beta Testers Wanted
by Crime - 03/04/13 06:55 AM
Hello Everyone
by Gremelin - 02/12/12 06:01 PM
Tracfone ESN Generator
by Zanvin Green - 01/18/12 01:31 PM
Python 3 issue
by Testing - 12/17/11 09:28 PM
tracfone airtime
by Drache86 - 07/30/11 03:37 AM
Backdoors and the Infinite
by ZeroCoolStar - 07/10/11 03:52 AM
HackThisZIne #12 Releaseed!
by Pipat2 - 04/28/11 09:20 PM
gang wars? l33t-wars?
by Gremelin - 04/28/11 05:56 AM
Consolidate Forums
by diggin2deep - 04/21/11 10:02 AM
LAN Hacking Noob
by Gremelin - 03/12/11 12:42 AM
Top Posters
UGN Security 41,392
Gremelin 7,203
§intå× 3,255
SilentRage 1,273
Ice 1,146
pergesu 1,136
Infinite 1,041
jonconley 955
Girlie 908
unreal 860
Top Likes Received
Ghost 2
Cyrez 1
Girlie 1
unreal 1
Crime 1
Powered by UBB.threads™ PHP Forum Software 7.7.5