Jump to content

TEDSON

Members
  • Posts

    11
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

TEDSON's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Thank you. That does meet my needs for now, and I'm just using wininet, instead of winhttp. Cheers.
  2. I'm having a little difficulty understanding this. I have my PHP script working fine on my webpage now, that querys mysql and echoes the result , but my goal is not to navigate to the page but to just get a return from it via call from my application (http post maybe?) So my hope is that someone can explain this in terms I can understand. I need to pass variables to the php code so it only checks a given row in a table. Example. SELECT code FROM mytable WHERE user = $variable // this needs to be passed to the code, but not via a form on the page. Most grateful for any explanaitions.
  3. I'm only a noob so I hope I'm not wrong here. I have learnt pretty quickly that its good practice to have error checking of some sort. for example $record = $_POST['record']; if (!$record) { echo 'Error. <br />Error # ', mysql_errno(), ' Error msg: ', mysql_error(); exit; } echo "<p>Search results for: $record<br><BR>"; It makes it easier to debug the code.
  4. Crikey! I was not expecting such a quick response, I'm not complaining and I appreciate it, thanks. Perfect. Panic over.
  5. I was expecting a return string, but got Resource id #2 instead. How do I have a string returned instead of that? heres my table user code Bob One Ted Two I dont get it :-\ <html> <body> <?php $con = mysql_connect("localhost","user","PassWord"); if (!$con) { echo 'Could not connect to MySQL server. <br />Error # ', mysql_errno(), ' Error msg: ', mysql_error(); exit; } $db = mysql_select_db("userdb") or die("Unable to select database"); if (!$db) { echo 'Could not select db. <br />Error # ', mysql_errno(), ' Error msg: ', mysql_error(); exit; } $query = "SELECT code from usertbl WHERE user = 'Ted' LIMIT 0 , 30"; $result = mysql_query($query, $con); if (!$result) { echo 'Could not query server. <br />Error # ', mysql_errno(), ' Error msg: ', mysql_error(); exit; } echo $result; ?> </body> </html> When I use that query in phpmyadmin it works Any pointers much appreciated
  6. I did take note of that, but didnt quite get it, its server side code, I get it now. I'm a happy bunny, and cam move along with my project now. Thanks, this thread is solved.
  7. Thanks, I'l have to look into that. My end goal, is to have user and password authentication via my database in my application, which will be ran on a users local machine. The app starts, the user enters user and pass, the app triggers the php script which in turn querys the data base, if its good, app continues, if not app exits. So I dont want the mysql user and pass viewable from view sourcecode of page. The help I recieved here has been fantastic, and I thank you kindly for it.
  8. Thank you so much for your help and time, I really appreciate it. I was using a database user and password, I tried my cpanel login credentiols and I get my Triumph message. I'm a little woried about having those details on my website though, is this normal practice?
  9. I'm unsure how to tell if its definately running in cpanel I can create databases and add tables, so I am assuming that it is running. I could be wrong though, its been known, I get the feeling I'm making some kind of schoolboy error. EDIT: I noticed there was no user associated with my db after manually creating it, so used the wizard, and the user was added, I temp gave user all access. Although as you pointed out I'm not even connecting to Mysql never mind database.
  10. Sorry, seems I'm out of time to edit my post. I've found that the page has to have a .php extension, rather than .htm I changed it and I get what I expected.. "FailCould not connect: Access denied for user 'user'@'localhost' (using password: YES)" My username and password are correct. I notice in the snippet code, it dosent aske the database name, could this be the problem? if so how do I define it?
  11. I'm really sorry if this has been answered (I assume it has) I'm unfamiliar with search terms of what I am trying to do. I have this web page <html> <body> <?php $con = mysql_connect("localhost","user","pass"); if (!$con) { echo "Fail"; die('Could not connect: ' . mysql_error()); } echo "Triumph"; ?> </body> </html> Which I got from a snippet. I load the webpage expecting to see fail or triumph, but I see nothing. My question is how to run the php script so I see something on the page (hopefully triumph. I apoligise for my noobness, I'm a PHP know nothing at the moment.
×
×
  • 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.