Raised This Month: $ Target: $400
 0% 

Need help with php script.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jonnzus
Epic Member
Join Date: Oct 2010
Location: Finland
Old 11-01-2012 , 09:26   Need help with php script.
Reply With Quote #1

I'm trying to make php script for fortumo, witch add order details to database.
Can someone tell me what is wrong with this, i'm very new in php

PHP Code:
<?php

//Senderit yms
$sender $_GET['sender'];
$message $_GET['message'];
$shortcode $_GET['shortcode'];
$message_id $_GET['message_id'];//unique id
  
  
$con mysql_connect("xxxt","xxx","xxxx");
if (!
$con)
  {
  die(
'Could not connect: ' mysql_error());
  }

mysql_select_db("sala"$con);

//sqllaan
        
mysql_query("INSERT INTO `Tilaukset` (sender, message, shortcode, message_id) VALUES('$sender', '$message', '$shortcode', '$message_id')") or die($reply_error);
        
// Execute query
mysql_query($sql,$con);
mysql_close($con);
  
?>
__________________
Quote:
367. Everyone's copyright will be broken. No exceptions.
jonnzus is offline
Brian-__-
Member
Join Date: Jan 2010
Old 11-01-2012 , 09:56   Re: Need help with php script.
Reply With Quote #2

PHP Code:
<?php
//Senderit yms
$sender $_GET['sender'];
$message $_GET['message'];
$shortcode $_GET['shortcode'];
$message_id $_GET['message_id'];//unique id
  
mysql_connect('xxxt','xxx','xxxx') or die('Could not connect: ' mysql_error());
mysql_select_db('sala');
mysql_query("INSERT INTO `Tilaukset` (sender, message, shortcode, message_id) VALUES('$sender', '$message', '$shortcode', '$message_id')");
?>
I think your code copied from another's and u just edited it

Last edited by Brian-__-; 11-01-2012 at 09:58.
Brian-__- is offline
jonnzus
Epic Member
Join Date: Oct 2010
Location: Finland
Old 11-01-2012 , 10:07   Re: Need help with php script.
Reply With Quote #3

Sherlock x)
I took some code from w3 school and edited. But well, I have to go now.
__________________
Quote:
367. Everyone's copyright will be broken. No exceptions.
jonnzus is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 11-02-2012 , 14:04   Re: Need help with php script.
Reply With Quote #4

mysql_connect and its friends are the old way of doing things using PHP and MySQL.

The cool kids all use PDO.

The slightly less cool kids use mysqli.

Note: My PHP is a bit rusty, as I haven't used PHP in several years.
__________________
Not currently working on SourceMod plugin development.
Powerlord is offline
Reply



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


All times are GMT -4. The time now is 23:13.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode