Jump to content

fogofogo

Members
  • Posts

    22
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

fogofogo's Achievements

Member

Member (2/5)

0

Reputation

  1. Hello I' having problems called a mssql stored proc with the following code... $myServer = "SERVER"; $myUser = "USER"; $myPass = "PASS"; $myDB = "DB"; //connection to the database $dbhandle = mssql_connect($myServer, $myUser, $myPass) or die("Couldn't connect to SQL Server on $myServer"); //select a database to work with $selected = mssql_select_db($myDB, $dbhandle) or die("Couldn't open database $myDB"); // call my proc fromhere function loginUser($alias, $password) { $proc = mssql_init('sp_CheckUserExists',$selected); mssql_bind($proc,'@Alias',$alias,SQLVARCHAR); mssql_bind($proc,'@Password',$password,SQLVARCHAR); if ($result = mssql_execute($proc)) { if ($row = mssql_fetch_row($result)) { // action } } And here are the erros I am getting.... Warning: mssql_init(): supplied argument is not a valid MS SQL-Link resource in Functions.php on line 70 Warning: mssql_bind(): supplied argument is not a valid MS SQL-Statement resource in Functions.php on line 72 Warning: mssql_execute(): supplied argument is not a valid MS SQL-Statement resource in Functions.php on lin Anyone know what theses errors are? THanks!
  2. looks like I messed it up. This fixed it CREATE PROCEDURE LoginUsers(IN palias VARCHAR(30), OUT pFirstName VARCHAR(30)) BEGIN SELECT FirstName INTO pFirstName FROM users WHERE Alias=palias; END
  3. Hello, I'm trying to create a stored procedure through phpmyadmin and its giving me an error. Heres my query... DROP PROCEDURE IF EXISTS `LoginUser` GO CREATE PROCEDURE LoginUser( IN p_Alias varchar(30) ) BEGIN SELECT FirstName FROM users WHERE Alias = p_Alias; END GO Its giving me an error saying ... check the manual that corresponds to your MySQL server version for the right syntax to use near 'GO Can anyone see the obvious error I'm making? Sorry I'm new to this. Cheers
  4. Thats right - sorry I should have said. It is an xml response. I'm take a look at this DOM business. Thanks!
  5. Hello all I am having a bit of trouble selecting a value from xml. The format of the xml is like this <newplayer> <transaction result="OK"/> <username>Jimbo</username> </newplayer> I am able to print out the value between the username nodes. I just cant figure out how to check what the falue is for result in transaction. I am using this code at the moment... function sendRegistrationPlaytech($URLString) { $url = "https://newplayer.php?" . $URLString; $ch = curl_init(); // set curl options curl_setopt($ch, CURLOPT_URL, $url); curl_setopt ($ch, CURLOPT_POST, 1); //curl_setopt ($ch, CURLOPT_POSTFIELDS, $form); curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0); $content = curl_exec ($ch); # This returns HTML curl_close ($ch); return $content; } Any help would be great Thanks
  6. not sure if it is - I thought FOR is a reserved name? I could be wrong. anyone know if this is the problem?
  7. Hello All, I have a script that displays and allows users to edit records in a mysql database. It displays the information correctly, but when I try to edit the information through forms I have created,  it gives me the "successful" message, but makes no changes to the database. I have printed out the sql, which looks like this... UPDATE division_1 SET Team='Dundee', Played='2', Won='3', Lost='4', Drawn='3', [For]='12', Against='5', Points='12' WHERE ID=2 and heres what the sql in the code looks like... UPDATE division_1 SET Team='".$Team."', Played='$Played', Won='$Won', Lost='$Lost', Drawn='$Drawn', [For]='$For', Against='$Against', Points='$Points' WHERE ID=".$id; theres probably blinding errors - I'm fairly new to this. Heres my code that inserts it into the database (sorry its a mess) - [CODE] <?php $host = "localhost"; $user = "root"; $passw="password"; $db = "millhill"; $connection = @mysql_connect($host, $user) or die (mysql_error()); mysql_select_db($db, $connection) or die (mysql_error()); $id = $_GET['id']; $Team = $_POST['Team']; $Played = $_POST['Played']; $Won = $_POST['Won']; $Lost = $_POST['Lost']; $Drawn = $_POST['Drawn']; $For = $_POST['For']; $Against = $_POST['Against']; $Points = $_POST['Points']; $submit = $_POST['submit']; if ($id) {   if ($submit) {     $sql = "UPDATE division_1 SET Team='".$Team."', Played='$Played', Won='$Won', Lost='$Lost', Drawn='$Drawn', [For]='$For', Against='$Against', Points='$Points' WHERE ID=".$id; echo $sql;     $result = mysql_query($sql); echo $result;     echo "Thank you! Information updated.\n";   } else {     // query the DB     $sql = "SELECT * FROM division_1 WHERE id=$id";     $result = mysql_query($sql);     $myrow = mysql_fetch_array($result);     ?>     <form method="post" action="<?php echo $PHP_SELF?>">     <input type=hidden name="id" value="<?php echo $myrow["ID"] ?>">     Team:<input type="Text" name="Team" value="<?php echo $myrow["Team"] ?>"><br>     Played<input type="Text" name="Played" value="<?php echo $myrow["Played"] ?>"><br>     Lost<input type="Text" name="Lost" value="<?php echo $myrow["Lost"] ?>"><br> Won:<input type="Text" name="Won" value="<?php echo $myrow["Won"] ?>"><br>     Drawn:<input type="Text" name="Drawn" value="<?php echo $myrow["Drawn"] ?>"><br> For:<input type="Text" name="For" value="<?php echo $myrow["For"] ?>"><br> Against:<input type="Text" name="Against" value="<?php echo $myrow["Against"] ?>"><br> Points:<input type="Text" name="Points" value="<?php echo $myrow["Points"] ?>"><br>     <input type="Submit" name="submit" value="Enter information">     </form> <?php } } else {   // display list of employees   $result = mysql_query("SELECT * FROM division_1",$connection );   while ($myrow = mysql_fetch_array($result)) {     printf("<a href=\"%s?id=%s\">%s %s</a><br>\n", $PHP_SELF, $myrow["ID"], $myrow["Team"], $myrow["Played"]);   } } [/CODE] any ideas what I'm doing wrong? Cheers
  8. fixed it - if anyone would like to see the code: [code]<?php // print out the month that has been choosen $month = $_POST['date']; echo $month; include("db.php"); // select the ddate //echo "SELECT * FROM  pokercredit WHERE DATE_FORMAT(ddate, '%Y %M')='.$month; $query = mysql_query("SELECT * FROM  pokercredit WHERE DATE_FORMAT(ddate, '%Y %M')='".$month."'"); // print out the records while ($row = mysql_fetch_array($query)){ echo "$row[ID] $row[dfrom] $row[damount]<br>";     // name class and mark will be printed with one line break at the end } ?>[/code] it might be messy, but it works!
  9. Hi folks, I have a form that submits a date in this format : June 2006, and I am trying to use it to select records in a mysql database, that stores the date in this format: 2006-06-01. So I must change June 2006 into 2006-06-01 and then feed it into the feed the date into the SQL statement - right?? This is the part I am stuck on. some thing like this? $formattedDate = date("F Y", strtotime($month)); my code so far (which is probably way off), looks like this... [code]<?php // print out the month that has been choosen $month = $_POST['date']; echo $month; //$formattedDate = date("F Y", strtotime($month)); ... database stuff ... $query = mysql_query("SELECT DISTINCT ddate, DATE_FORMAT(ddate, '%Y %M')  ID FROM pokercredit"); // print out the records while ($row = mysql_fetch_array($query)){ echo "$row[ID] $row[dfrom] $row[damount]<br>";     // name class and mark will be printed with one line break at the end } ?>[/code] I'm obviously way off but any advice would be great, as I'm totally stuck on this. Thanks all J
  10. [!--quoteo(post=379038:date=Jun 1 2006, 07:14 AM:name=MikoMak)--][div class=\'quotetop\']QUOTE(MikoMak @ Jun 1 2006, 07:14 AM) [snapback]379038[/snapback][/div][div class=\'quotemain\'][!--quotec--] Hi, you probably want to use the mysql function date_format() to pull out just the month from the table e.g. something like $sql_date = mysql_query("SELECT date_format(ddate, '%M ') as ddate FROM casinocredit ") This will give you just the months by name and not the full date. (use '%M %Y' if you need the month and year e.g. May 2006 ) hth. [/quote] Thats cool - cheers Miko
  11. Hello all, I am trying to populate a drop down menu with a mysql database. I was hoping to have a selection of months in the dropdown menu, based on date fields in my database (displayed like january, february, march, april, ,may etc) when a user then selects a month, they will be brought to a new page that will have only the records created in that month. But in my database, the date is stored in this format: 2006-05-12 00:00:00 Is there any way that I could replace the dates with the months? for example : 2006 - 05, would be May 2006. if you need to see my code, here it is: [code]<? //database connection $query = mysql_query("SELECT * FROM casinocredit"); // start to print out the form echo "<form action=\"cats.php\" method=\"POST\"><select name=\"clients\"><option value=\"\" \"selected\">Select A Client</option>"; // loop through the records while ($row = mysql_fetch_array($query)) { echo "<option value=\"{$row['ID']}\">{$row['ddate']}</option>"; } echo "</select>"; echo "<input type=\"submit\" value=\"Go\"></form>"; ?>[/code] Anyone have any advice or opinions? Thanks for your time J[code][/code]
  12. [!--quoteo(post=379007:date=Jun 1 2006, 04:45 AM:name=SemiApocalyptic)--][div class=\'quotetop\']QUOTE(SemiApocalyptic @ Jun 1 2006, 04:45 AM) [snapback]379007[/snapback][/div][div class=\'quotemain\'][!--quotec--] Can't say that I have, but I'd guess the harder thing to figure out would be the logic behind calculating the odds. Once you know how to do that, scripting it in PHP should be easy, I'm confident that it could be done with basic coding methods. [/quote] I should have given more info - sorry! I actually already have formulas worked out using excel - but I think the php will be a little bit beyond me. I think I might leave it, thanks anyway!
  13. Hi Folks - anyone ever come across a poker odds calculator tutortial, built with php? Cheers J
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.