Jump to content

Where can i learn Mysqli


scheols

Recommended Posts

One: how did you manage to fill in the register form of this website?
Two: who allowed you?
Three: ever heard of google?
Four: manuals ever heard of?
Five: here is your damn tutorial/manual http://devzone.zend.com/node/view/id/686

It is always nice to see, people doing some effort to get something...
Link to comment
Share on other sites

Looking for more of a manual not a tutorial

can i ask a question mysqli is way different then regular MySQL and yes i heard of google

mysql
[code=php:0]

<?
$uname ="Uname";//Username
$upass ="upass";//Userpassword
$database="dbname";//Database name
mysql_connect("localhost",$uname,$upass);
mysql_select_db($database) or die(mysql_error());
?>
[/code]

mysqli
[code=php:0]
<?php

/* Connect to a MySQL server */
$link = mysqli_connect(
            'localhost',  /* The host to connect to */
            'user',      /* The user to connect as */
            'password',  /* The password to use */
            'world');    /* The default database to query */

if (!$link) {
  printf("Can't connect to MySQL Server. Errorcode: %s\n", mysqli_connect_error());
  exit;
}
?>
[/code]
Link to comment
Share on other sites

hearing of it is not enough, its using it that defines you...
look, i'm not trying to insult you or anything, but "where can you learn mysqli?" on php.net or read a book, want help with something involving mysqli (a function not working, strange error's, etc...), that's what we are here for, we're not gonna play your teacher..

@scheols if you know mysql, you will be easily picking up with mysqli, because the changes aren't that big... you still connect with your database through mysqli_connect(); the only difference is that mysql_select_db() is left out and an i has been added to the connect function! You also have the ability to directly put your database name in your connect function

here a direct link to it: http://php.belnet.be/manual/nl/function.mysqli-connect.php i will post a tutorial/manual later on to explain its use
Link to comment
Share on other sites

[quote author=ignace link=topic=103195.msg410809#msg410809 date=1154889446]
hearing of it is not enough, its using it that defines you...
look, i'm not trying to insult you or anything, but "where can you learn mysqli?" on php.net or read a book, want help with something involving mysqli (a function not working, strange error's, etc...), that's what we are here for, we're not gonna play your teacher..

@scheols if you know mysql, you will be easily picking up with mysqli, because the changes aren't that big... you still connect with your database through mysqli_connect(); the only difference is that mysql_select_db() is left out and an i has been added to the connect function! You also have the ability to directly put your database name in your connect function
[/quote]its more then just mysqli_connect kid now if you dont want 2 help fine with me leave this thread as i said i know mysql i want to know more about mysqli do u understand? its a help forum, now im looking forsomeone who can tell me where i can learn this mysqli functions etc..  please stop posting.
Link to comment
Share on other sites

Has this forum suddenly turned into somewhere for people to slag each other off?

Anyways, scheols, without further irritating anyone, from what you have said, ignace is right; the manual has to be the best place to start. You just said you are looking to learn about mysqli functions, and the manual gives details about all of them. The menu on this page:
http://uk.php.net/mysqli_connect
Has all of the functions. Why not try looking at them and if there are specific functions you need help with, then ask away.
Link to comment
Share on other sites

Now, what you originally requested..

first of all mysqli can be used like you have always used mysql or in oop style

[b]"Normal" mode:[/b]
[code]
<?php
$link = mysqli_connect("localhost", "my_user", "my_password", "world");
 
/* check connection */
if (mysqli_connect_errno()) {
  printf("Connect failed: %s\n", mysqli_connect_error());
  exit();
}
 
mysqli_query($link, "CREATE TABLE myCity LIKE City");

/* Prepare an insert statement */
$query = "INSERT INTO myCity (Name, CountryCode, District) VALUES (?,?,?)";
$stmt = mysqli_prepare($link, $query);

mysqli_stmt_bind_param($stmt, "sss", $val1, $val2, $val3);

$val1 = 'Stuttgart';
$val2 = 'DEU';
$val3 = 'Baden-Wuerttemberg';
 
/* Execute the statement */
mysqli_stmt_execute($stmt);

$val1 = 'Bordeaux';
$val2 = 'FRA';
$val3 = 'Aquitaine';
 
/* Execute the statement */
mysqli_stmt_execute($stmt);

/* close statement */
mysqli_stmt_close($stmt);

/* retrieve all rows from myCity */
$query = "SELECT Name, CountryCode, District FROM myCity";
if ($result = mysqli_query($link, $query)) {
  while ($row = mysqli_fetch_row($result)) {
      printf("%s (%s,%s)\n", $row[0], $row[1], $row[2]);
  }
  /* free result set */
  mysqli_free_result($result);
}

/* remove table */
mysqli_query($link, "DROP TABLE myCity");

/* close connection */   
mysqli_close($link);
?>
[/code]

[b]Using Object Oriented Style[/b]
[code]
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
 
/* check connection */
if (mysqli_connect_errno()) {
  printf("Connect failed: %s\n", mysqli_connect_error());
  exit();
}
 
$mysqli->query("CREATE TABLE myCity LIKE City");

/* Prepare an insert statement */
$query = "INSERT INTO myCity (Name, CountryCode, District) VALUES (?,?,?)";
$stmt = $mysqli->prepare($query);

$stmt->bind_param("sss", $val1, $val2, $val3);

$val1 = 'Stuttgart';
$val2 = 'DEU';
$val3 = 'Baden-Wuerttemberg';
 
/* Execute the statement */
$stmt->execute();

$val1 = 'Bordeaux';
$val2 = 'FRA';
$val3 = 'Aquitaine';
 
/* Execute the statement */
$stmt->execute();

/* close statement */
$stmt->close();

/* retrieve all rows from myCity */
$query = "SELECT Name, CountryCode, District FROM myCity";
if ($result = $mysqli->query($query)) {
  while ($row = $result->fetch_row()) {
      printf("%s (%s,%s)\n", $row[0], $row[1], $row[2]);
  }
  /* free result set */
  $result->close();
}

/* remove table */
$mysqli->query("DROP TABLE myCity");

/* close connection */   
$mysqli->close();
?>
[/code]

if there is something you don't understand, then i'll probably will be hearing from you...
Link to comment
Share on other sites

[b]If there is anymore swearing/slagging each other off in this thread again this thread will be closed. I have gone through and removed much of the swearing from this thread, please keep in mind there is possibly minors browsing this forum.

Also ignace if you dont like people asking these types of questions then don't bother replying.[/b]
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.