Jump to content

[SOLVED] Did I get in or not?


jmr3460

Recommended Posts

I am having some issues with a script that I am working with. I am going to start with the first part of the script and work my way to the end. I don't know if I am actually getting into the db. When I run this file I get this on browser>

 



 

This is my code:

<?

/**
* Connect to the mysql database.
*/
$host = "localhost";
$user = "username";
$password = "password";
$database = "database_name";

$conn = mysql_connect($host, $user, $password) or die("could nit get in" . mysql_error() );

mysql_select_db($database, $conn) or die("could nit get in db" . mysql_error());

?>

 

Can anyone help me? Thanks for any knowledge.

Link to comment
Share on other sites

Just run some SQL -

 

<?php
/**
* Connect to the mysql database.
*/
$host = "localhost";
$user = "username";
$password = "password";
$database = "database_name";

$conn = mysql_connect($host, $user, $password) or die("could nit get in" . mysql_error() );
mysql_select_db($database, $conn) or die("could nit get in db" . mysql_error());

$sql = 'SHOW TABLES;';
$results = mysql_query($sql) or die('sql failed - ' . mysql_error());
while ($row = mysql_fetch_assoc($results)) var_dump($row);

 

If you see something other than errors, then it works. :)

Link to comment
Share on other sites

I tried this:

<?php

/**
* Connect to the mysql database.
*/
$host = "localhost";
$user = "simplic5_jmr3460";
$password = "freedom98714";
$database = "simplic5_users";

$conn = mysql_connect($host, $user, $password) or die("could not get in" . mysql_error() );

mysql_select_db($database, $conn) or die("could not get in db" . mysql_error());

   $q = "select username from users where username = '$username'";
   $result = mysql_query($q,$conn);
echo "$result";
?>

 

I got this on my browser:

Resource id #2

Link to comment
Share on other sites

OK I tried what you requested and I got this:

 

 

array(1) { ["Tables_in_simplic5_users"]=>  string(10) "auth_users" } array(1) { ["Tables_in_simplic5_users"]=>  string(5) "users" }

 

 

Looks like I am getting in. I have two tables users and auth_users. Thanks for all of your help.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.