Jump to content


Check out our Community Blogs

mnamjad

Member Since 22 Nov 2010
Offline Last Active Mar 15 2015 06:47 AM
-----

Posts I've Made

In Topic: Please help me add this data to a db

23 November 2010 - 12:26 AM

Your insert statement is incorrect.
When you are using variables then there is no need of single quote like $Name should be used instead of '$Name'.

So the correct code will be look like:
$sql="INSERT INTO $tbl(name, msg)VALUES($Name, $Msg)";

In Topic: I need help adding a image

23 November 2010 - 12:09 AM

Its quite simple...

In html <img> tag is used to add an image on the page.

<img> tag contain two main attribute. (src & alt)
src tells the source path of the image.
alt is the tooltip that shows when you put the cursor on the image.

For example, your image file name is image.gif and it is placed in the same folder, then your code to add image on the page will be.

<img src="image.gif" alt="Image" />


In Topic: converting text file to php help me

22 November 2010 - 11:57 PM

The easiest why to do it, by rename the file.

Right click on your file.php, select rename from the available options.

Remove .php from that name and place .txt in the file name and press enter. A message will occur "Do you really want to change the type of the file". Select "Yes", your file will be renamed.

If you want to do this because you want to open it easily then you can open it by drag this file on the notepad. The notepad will show all the data in that .php file.

In Topic: Which PHP CMS is the best one you would like to recommend?

22 November 2010 - 11:40 PM

The most commonly used cms are Joomla, Magento, Wordpress and drupal. All of them have their advantages and disadvantages. You cant select the best from all these, it all depends on your requirement.

If you need a blog based site then wordpress is the best tool.
If you need to develop a big cms site then Joomla is better.

So all these varies according to the requirements and the selection of CMS depends on your requirement.

One more thing, "Do not reinvent the wheel.". If you think that any of the CMS can give you the required solution then no need to start from scratch.

In Topic: Login script authencation help needed!

22 November 2010 - 08:31 AM

What i would suggest is when connecting to database always use DIE code in that. There is no need of quotes when using variable.

Code:

<?php
$host = "localhost";
$user = "root";
$pass = "root";
$database = "website";

mysql_connect($host, $user, $pass) or DIE('Connection to host is failed, perhaps the service is down!');
mysql_select_db($database) or DIE('Database name is not available!');

?>


In the second code, you need to use concatenation (.) operator to concatenate string and variable, use the below code


<?php
require_once(templates/dbconnect.php);

$username = $_POST['username'];
$password = $_POST['password'];

if (empty $username)
{
header ('Location: index.php?report=Please+fill+in+your+username!');
}

if (empty $password)
{
header ('Location: index.php?report=Please+fill+in+your+password!');
}

$username = stripslashes($username);
$password = stripslashes($password);
$username = mysql_real_escape_string($username);
$password = mysql_real_escape_string($password);

$query = "SELECT * FROM users WHERE username="'" . $username . "' " AND password= " '" . $password . "';

$checkuser = mysql_query($query);

$row = mysql_num_rows($checkuser);

if ($row == 1)
{
session_start();
$_SESSION['username'] = $username;
$_SESSION['logged_in'] = "1";
header ("Location: user/index.php");
}
?>

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download