Go Back   Novahq.net Forum > Computers > Web design and Programming

Web design and Programming Discuss website creation and other programming topics.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 05-27-2005, 11:41 AM
General Nuisance is offline General Nuisance
Registered User

Join Date: Oct 2004
Posts: 616

Send a message via ICQ to General Nuisance
my first php script..

i wrote my first php script!

rather simple but i could not do any b 4

go to my site ( click banner in sig) on right there is link called Whats my ip click it...

i'm gonna slowly re do whole site in php... wright my own portal SLOWLY... some of this php stuff don't make much since... but some is really easy..
__________________
The Nova-Zone


http://youraite.yourhost.yourusername.com - long urls
-looks bad
-who can remember it?
- Solution?
- Get a short Nova-Zone subdomain! Yoursite.nova-zone.com
- Now thats smart. just ask for one via pm,email or contact page on site.
Reply With Quote
  #2  
Old 05-27-2005, 11:43 AM
Steve is offline Steve
Steve's Avatar
Administrator

Join Date: Sep 2001
Location: 2077
Posts: 21,552

Send a message via ICQ to Steve
the only thing on the right is Sponsors and top sites.

in what way do we sponsor you btw?
Reply With Quote
  #3  
Old 05-27-2005, 11:50 AM
General Nuisance is offline General Nuisance
Registered User

Join Date: Oct 2004
Posts: 616

Send a message via ICQ to General Nuisance
yes you do.. in a way.. my the link is on the forum.. and the link was is the news....by "sponsors" i mean Links but Sponsors looks better...
__________________
The Nova-Zone


http://youraite.yourhost.yourusername.com - long urls
-looks bad
-who can remember it?
- Solution?
- Get a short Nova-Zone subdomain! Yoursite.nova-zone.com
- Now thats smart. just ask for one via pm,email or contact page on site.
Reply With Quote
  #4  
Old 05-27-2005, 11:53 AM
Steve is offline Steve
Steve's Avatar
Administrator

Join Date: Sep 2001
Location: 2077
Posts: 21,552

Send a message via ICQ to Steve
coolio
Reply With Quote
  #5  
Old 05-27-2005, 12:21 PM
General Nuisance is offline General Nuisance
Registered User

Join Date: Oct 2004
Posts: 616

Send a message via ICQ to General Nuisance
im working on a link data base as i type...
__________________
The Nova-Zone


http://youraite.yourhost.yourusername.com - long urls
-looks bad
-who can remember it?
- Solution?
- Get a short Nova-Zone subdomain! Yoursite.nova-zone.com
- Now thats smart. just ask for one via pm,email or contact page on site.
Reply With Quote
  #6  
Old 05-27-2005, 12:25 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
Cool...I gotta go do some work on my site too
__________________
Reply With Quote
  #7  
Old 05-27-2005, 01:39 PM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

Re: my first php script..

Quote:
Originally posted by General Nuisance
i wrote my first php script!

rather simple but i could not do any b 4

go to my site ( click banner in sig) on right there is link called Whats my ip click it...

i'm gonna slowly re do whole site in php... wright my own portal SLOWLY... some of this php stuff don't make much since... but some is really easy..
gj bro!

are you useing
PHP Code:
$ip getnv($REMOTE_ADDR); 
or
PHP Code:
$ip $_SERVER['REMOTE_ADDR']; 
?

oh yeah...classes classes classes. PHP classes are amazingly nice...I'm using it for all mysql Queries

PHP Code:

class Queries {
     var 
$hi;
     var 
$bye;
     function 
shoot($hi,$bye){
         
uh ...
 }

yeah yeah classes are hard and your going why is he posting this... but trust me... they'll make your coding go a lot quicker

(When i say classes i don't mean like a teacher and school or something i mean actually coding)...
Reply With Quote
  #8  
Old 05-27-2005, 02:05 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
ohh yah I remember classes from the good old C++ days.
__________________
Reply With Quote
  #9  
Old 05-27-2005, 03:37 PM
General Nuisance is offline General Nuisance
Registered User

Join Date: Oct 2004
Posts: 616

Send a message via ICQ to General Nuisance
Re: Re: my first php script..

PHP Code:
$ip $_SERVER['REMOTE_ADDR']; 
[/B][/QUOTE]

that one ^^^

whats the difference?
__________________
The Nova-Zone


http://youraite.yourhost.yourusername.com - long urls
-looks bad
-who can remember it?
- Solution?
- Get a short Nova-Zone subdomain! Yoursite.nova-zone.com
- Now thats smart. just ask for one via pm,email or contact page on site.
Reply With Quote
  #10  
Old 05-27-2005, 03:42 PM
atholon is offline atholon
"ath-hole"

Join Date: Jan 2003
Location: Failville.
Posts: 11,357

Send a message via MSN to atholon
that is awesome...that helps when you want to ban someone from your site.
__________________
Reply With Quote
  #11  
Old 05-27-2005, 06:27 PM
IcIshoot is offline IcIshoot

Join Date: Mar 2004
Location: Farmington Hills, MI
Posts: 1,473

Send a message via AIM to IcIshoot Send a message via MSN to IcIshoot Send a message via Yahoo to IcIshoot
Quote:
that one ^^^

whats the difference?
There really isn't any... just 2 ways of doing the same thing.

Personally, I always use the $_SERVER[] method, for $_GET, $_POST, etc.


And from what I just read, getenv() (Elite, pls note the correct function name ) really shouldn't be used. I just read a comment that getenv() doesn't work on IIS (Microsoft's webserver).


IcI
Reply With Quote
  #12  
Old 05-27-2005, 07:20 PM
JonM is offline JonM
Registered User

Join Date: Jun 2004
Posts: 2,156

seeings how mainly sites are run on linux it works if your coding for your self (Ici ... it's been a while since i used the function so i forgot okay!, ) ... :P
Reply With Quote
  #13  
Old 05-27-2005, 10:35 PM
IcIshoot is offline IcIshoot

Join Date: Mar 2004
Location: Farmington Hills, MI
Posts: 1,473

Send a message via AIM to IcIshoot Send a message via MSN to IcIshoot Send a message via Yahoo to IcIshoot
lol.

But still, wouldn't it be better to code some things, when possible so that they can work no matter what the system?

Any ways, doesn't really matter.


IcI
Reply With Quote
  #14  
Old 05-28-2005, 08:50 PM
General Nuisance is offline General Nuisance
Registered User

Join Date: Oct 2004
Posts: 616

Send a message via ICQ to General Nuisance
my link database..

hey i finnished codeing a link database but it does not seem to work proberly....

please look over my code i have checked and checked it...

PHP Code:
<html><head><title>Add Your Link</title></head>
<body>
<?php

$self 
$_SERVER['PHP_SELF'];
$nn $_POST['nn'];
$url $_POST['url'];
$lname $_POST['lname'];
$sc $_POST['sc'];
?>
<form action="<?php echo( $self ) ; ?>" method= "post">
Your Nick Name: <input type="text" name="nn" size="25">
<BR>
Your Websites Catagory: 
  <select size="1" name="sc">
  <option>Please Select</option>
  <option>Delta Force Xtreme Resource</option>
  <option>Joint Operations Escalation Resource</option>
  <option>Joint Operations Resource</option>
  <option>Delta Force Xtreme Squad</option>
  <option>Joint Operations Escalation Squad</option>
  <option>Joint Operations Squad</option>
  </select>
<BR>
Your Websites Name: <input type="text" name="lname" size="80">
<BR>
Your Websites URL: <input type= "text" name="url" size"80">
<BR>
<input type="submit" value="Submit Your Link"> </form>
<BR>

<?php

if( $nn and $url and $lname and $sc # makeing sure fields are filled in
# connecting to Mysql
$conn=@mysql_connect"localhost""My user name""My Password" ) or die( "err:conn" );

#selecting Database

$rs = @mysql_select_db"linkdb"$conn ) or die( "err:conn" );

#create the query

$sql="insert into links (NN, sc, LName, URL) values ( $NN, \"$sc\", \"$LName\", \"$url\" )";

#execute the query

$rs mysql_query$sql$conn );

#confirm the added link

if($rs){ echo( "The Link $lname was Added To the $sc Database!" ); }
}

?>

</body></html>
see this page

HERE
__________________
The Nova-Zone


http://youraite.yourhost.yourusername.com - long urls
-looks bad
-who can remember it?
- Solution?
- Get a short Nova-Zone subdomain! Yoursite.nova-zone.com
- Now thats smart. just ask for one via pm,email or contact page on site.
Reply With Quote
  #15  
Old 05-28-2005, 09:22 PM
IcIshoot is offline IcIshoot

Join Date: Mar 2004
Location: Farmington Hills, MI
Posts: 1,473

Send a message via AIM to IcIshoot Send a message via MSN to IcIshoot Send a message via Yahoo to IcIshoot
For the forum action, change it from

PHP Code:
<?php echo( $self ) ; ?>
to

PHP Code:
<?= $self?>
(I didn't try submitting the data to a database, but I was able to have the script echo back the selected results making that change.)


IcI
Reply With Quote
  #16  
Old 05-28-2005, 10:59 PM
General Nuisance is offline General Nuisance
Registered User

Join Date: Oct 2004
Posts: 616

Send a message via ICQ to General Nuisance
does not work for me

this is updateed code:

PHP Code:
 <html><head><title>Add Your Link</title></head>
<body>
<?php

$self 
$_SERVER['PHP_SELF'];
$nn $_POST['nn'];
$url $_POST['url'];
$lname $_POST['lname'];
$sc $_POST['sc'];
?>
<form action="<?php $self ?>" method= "post">
Your Nick Name: <input type="text" name="nn" size="25">
<BR>
Your Websites Catagory: 
  <select size="1" name="sc">
  <option>Please Select</option>
  <option>Delta Force Xtreme Resource</option>
  <option>Joint Operations Escalation Resource</option>
  <option>Joint Operations Resource</option>
  <option>Delta Force Xtreme Squad</option>
  <option>Joint Operations Escalation Squad</option>
  <option>Joint Operations Squad</option>
  </select>
<BR>
Your Websites Name: <input type="text" name="lname" size="80">
<BR>
Your Websites URL: <input type= "text" name="url" size"80">
<BR>
<input type="submit" value="Submit Your Link"> </form>
<BR>

<?php

if( $nn and $url and $lname and $sc # makeing sure fields are filled in
# connecting to Mysql
$conn=@mysql_connect"localhost""my username""my password" ) or die( "err:conn" );

#selecting Database

$rs = @mysql_select_db"linkdb"$conn ) or die( "err:conn" );

#create the query

$sql="insert into links (NN, sc, LName, URL) values ( $NN, \"$sc\", \"$LName\", \"$url\" )";

#execute the query

$rs mysql_query$sql$conn );

#confirm the added link

if($rs){ echo( "The Link $lname was Added To the $sc Database!" ); }
}

?>

</body></html>
PS.

i also tried it exactly the way you did it that did not work either..
__________________
The Nova-Zone


http://youraite.yourhost.yourusername.com - long urls
-looks bad
-who can remember it?
- Solution?
- Get a short Nova-Zone subdomain! Yoursite.nova-zone.com
- Now thats smart. just ask for one via pm,email or contact page on site.
Reply With Quote
  #17  
Old 05-28-2005, 11:10 PM
Scott is offline Scott
Scott's Avatar
AKA. Panther

Join Date: Sep 2001
Location: Minneapolis, MN
Posts: 10,919

<?=$value?> will only work one some php settings.. so it's best to use <?Echo($value);?>.. but for your problem I think it's the mysql query.. I made alot of notes to atholon in another thread please read that.. it can be found here. http://www.novahq.net/forum/showthre...threadid=26098
__________________

04' Dodge SRT-4, Mopar Stage 3, 406whp/436wtq
Reply With Quote
  #18  
Old 05-28-2005, 11:29 PM
IcIshoot is offline IcIshoot

Join Date: Mar 2004
Location: Farmington Hills, MI
Posts: 1,473

Send a message via AIM to IcIshoot Send a message via MSN to IcIshoot Send a message via Yahoo to IcIshoot
I added an IF statment
PHP Code:
if (isset($_POST['submit'])) 
so that the data handling stuff doesn't take place unless data is actually being submitted.


When i ran this, every thing worked, except for the mysql part due to the fact I didn't want to set up a test table . I just commented it out and put echo statements to tell me what was happening.

Try this:

(again, I didn't test to see if the database part worked)

PHP Code:
<?php
  
echo "<html><head><title>Add Your Link</title></head> 
<body>"
;


$self $_SERVER['PHP_SELF']; 
$nn $_POST['nn']; 
$url $_POST['url']; 
$lname $_POST['lname']; 
$sc $_POST['sc']; 

echo 
'<form action="'.$self.'" method="post"> 
Your Nick Name: <input type="text" name="nn" size="25"> 
<BR> 
Your Websites Catagory: 
  <select size="1" name="sc"> 
  <option>Please Select</option> 
  <option>Delta Force Xtreme Resource</option> 
  <option>Joint Operations Escalation Resource</option> 
  <option>Joint Operations Resource</option> 
  <option>Delta Force Xtreme Squad</option> 
  <option>Joint Operations Escalation Squad</option> 
  <option>Joint Operations Squad</option> 
  </select> 
<BR> 
Your Websites Name: <input type="text" name="lname" size="80"> 
<BR> 
Your Websites URL: <input type= "text" name="url" size"80"> 
<BR> 
<input type="submit" value="Submit Your Link" name="submit"> </form> 
<BR>'
;

//Check to see if data is being submitted:
if (isset($_POST['submit'])) {
    
if( 
$nn and $url  and $lname  and $sc 
0
# makeing sure fields are filled in 

# connecting to Mysql 

$conn=@mysql_connect"localhost""my username""my password" ) or die( "err:conn" ); 

#selecting Database 

$rs = @mysql_select_db"linkdb"$conn ) or die( "err:conn"); 

#create the query 

$sql="insert into links (NN, sc, LName, URL) values ( $NN, \"$sc\", \"$LName\", \"$url\" )"

#execute the query 

$rs mysql_query$sql$conn ); 

#confirm the added link 

if($rs){ echo( "The Link $lname was Added To the $sc Database!" ); } else
{
    echo 
"Error submitting link $lname to the $sc Database";
}
}
 
 else
{
    echo 
"some of the fields were not entered in, please try again";
}
}
echo 
"</body></html>";
?>
Reply With Quote
  #19  
Old 05-28-2005, 11:35 PM
General Nuisance is offline General Nuisance
Registered User

Join Date: Oct 2004
Posts: 616

Send a message via ICQ to General Nuisance
ok thx panther but i dont know what would be wrong with mysql... here is pic of phpmyadmin

[img] http://24.158.37.186/phpmyadmin.jpg [/img]
__________________
The Nova-Zone


http://youraite.yourhost.yourusername.com - long urls
-looks bad
-who can remember it?
- Solution?
- Get a short Nova-Zone subdomain! Yoursite.nova-zone.com
- Now thats smart. just ask for one via pm,email or contact page on site.
Reply With Quote
  #20  
Old 05-28-2005, 11:41 PM
General Nuisance is offline General Nuisance
Registered User

Join Date: Oct 2004
Posts: 616

Send a message via ICQ to General Nuisance
Quote:
Originally posted by icishoot
I added an IF statment
PHP Code:
if (isset($_POST['submit'])) 
so that the data handling stuff doesn't take place unless data is actually being submitted.


When i ran this, every thing worked, except for the mysql part due to the fact I didn't want to set up a test table . I just commented it out and put echo statements to tell me what was happening.

Try this:

(php code removed to keep short.. -gen nuisance)


now that dont work at all for me the page will not even display...
__________________
The Nova-Zone


http://youraite.yourhost.yourusername.com - long urls
-looks bad
-who can remember it?
- Solution?
- Get a short Nova-Zone subdomain! Yoursite.nova-zone.com
- Now thats smart. just ask for one via pm,email or contact page on site.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Trying to get php script to work with ajax(jquery) alvidales phphq.Net Forums 0 06-28-2011 10:24 AM
What PHP script is this? Chels Web design and Programming 11 02-04-2006 05:45 AM
PHP NEWS SCRIPT? o2 phphq.Net Forums 8 10-30-2004 02:57 PM
Php Database Script area51-(xs)- Web design and Programming 8 06-27-2003 09:24 AM
php news script? Se7eN Web design and Programming 2 05-04-2003 12:09 PM


All times are GMT -5. The time now is 09:00 PM.




Powered by vBulletin®