Jump to content

PHP+MySQL??


tuxbuddy

Recommended Posts

  • Replies 75
  • Created
  • Last Reply

Top Posters In This Topic

Listen !!! The Only HelpCORE directory wont work you need database too...man.

If you will notice there is database directory under HelpCORE.There are two file :

db_mysql_6.4.sql  and db_mysql_6.4_defaults_en.sql

 

Just import them to ur database.

And then only you will login properly

Link to comment
Share on other sites

Dude !! I need ur Help Again regarding the query we discussed.

 

I have this code:

FIle : incidents_show.php

<html><table width="300" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#CCCCCC">
<p>
<body bgcolor="#d0d0d0">

<img src="helpcore.jpg" align="center">
</p>
<tr>
<form name="form1" method="post" action="status.php">

<td>
<table width="100%" border="0" cellpadding="3" cellspacing="1" bgcolor="#FFFFFF">
<tr>
<td colspan="3"><strong>&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<u>Check your Call Status </u></strong></td>
</tr>
<tr>
<td width="78">Open </td>
<td width="6">:</td>
<td width="294">
<Input type ='radio' Name ='gender' value='open'>


</td>
</tr>
<tr>

<td width="78">Closed</td>
<td width="6">:</td>
<td width="310">
<Input type ='radio' Name='gender' value='closed'>



<tr>
<td> </td>
<td> </td>
<td><input type="submit" name="Submit1" value="Submit"></td>
</tr>

</table>
</td>
</form>
</tr>
</form>
</tr>
</table>
[/html]

 

 

In the above if I click on any one say "Open " it should display Open Calls.Now I have this code which I thnk work now for only Open...How can I add CLose calls too???

 

Here the code:

FIle: Status.php

<html>
<title> Welcome to Project Management Tool</title>
<body bgcolor=#AFC7C7>
<h1> Report</h1>


<?php
session_start();

$myusername = $_SESSION['myusername'];


//put the above right at the top of your script. Everything else can follow
?>

<?

//header("Content-Type: text/plain");


/* set's the variables for MySQL connection */

$server = "localhost:3306"; // this is the server address and port
$username = "root"; // change this to your username
$password = "mysql123"; // change this to your password

/* Connects to the MySQL server */

$link = @mysql_connect ($server, $username, $password)
or die (mysql_error());

/* Defines the Active Database for the Connection */

if (!@mysql_select_db("helpcore", $link)) {
     echo "<p>There has been an error. This is the error message:</p>";
     echo "<p><strong>" . mysql_error() . "</strong></p>";
     echo "Please Contact Your Systems Administrator with the details";
}

$sql1 = mysql_query("SELECT id from users where loginname ='".$myusername."'",$link);

while($row=mysql_fetch_row($sql1 ))
{
                                   {
#echo $result[0];
$uid=$row[0];
echo $uid;
#$uid=$result["id"];
#echo "$uid";

}

#$result2 = mysql_query("SELECT incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users WHERE (incidents.owner_id = users.id) AND (incidents.contact_id = '".$result[0]."')", $link);
$result2 = mysql_query("SELECT  incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users where (incidents.owner_id = users.id) OR (incidents.owner_id= NULL) AND (incidents.contact_id = '".$result[0]."')", $link);
#echo ("SELECT incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users WHERE (incidents.owner_id = users.id) OR (incidents.contact_id = '".$uid."')";
echo $result2 ;

#$result2 = mysql_query("SELECT incidents.id,incidents.description,users.firstname,users.surname,users.loginname from incidents,users where (incidents.owner_id = users.id) OR (incidents.contact_id =  '".$uid."')", $link);




if (!$result2) {
  echo("<p>Error performing query: " . mysql_error() . "</p>");
  exit();
}

/* Starts the table and creates headings */
?>
<table border="1">
<tr>
<td><strong>ID</strong></td>

<td><strong>Description</strong></td>
<td><strong>Owner Name</strong></td>
<td><strong>Notes</strong></td>

</tr>
<?
/* Retrieves the rows from the query result set
and puts them into a HTML table row */
              <td><strong>Description</strong></td>
<td><strong>Owner Name</strong></td>
<td><strong>Notes</strong></td>

</tr>
<?
/* Retrieves the rows from the query result set
and puts them into a HTML table row */
#echo "hello";
#echo "$myusername";
while ($row = mysql_fetch_array($result2, MYSQL_ASSOC)) {


echo "\n";
     echo("<tr>\n<td>" . $row["id"] . "</td>");
    echo("<td>" . $row["description"] . "</td>");
    echo("<td>" . $row["firstname"] . $row["surname"]. "</td>");
    echo("<td>" . $row["loginname"] . "</td></tr>");

   # echo("<td>" . $row["name"] . "</td>");
   # echo("<td>" . $row["create_time"] . "</td>");
}

/* Closes the table */
?>
</table>
<?

/* Closes Connection to the MySQL server */

mysql_close ($link);
?>



             

 

Pls Help me with this ??

 

Link to comment
Share on other sites

Listen !!! I have two radio Button which when clicked should produce output as per instructions.

The second file above is : Status.php is all about Open Calls for whch I have written query...In the same way Say:

 

A Hint :

if (clickedon = Open)

{

<.....query>

else

{

if (clickedon = Finished/Closed)

{

<query>

Link to comment
Share on other sites


like this??????????????

<?

session_start();

$clicked=$_POST["gender"];

?><?
if($clicked=="open")
{
?>
<html>
<title> Welcome to Project Management Tool</title>
<body bgcolor=#AFC7C7>
<h1> Report</h1>


<?php

$myusername = $_SESSION['myusername'];
echo $myusername;

//put the above right at the top of your script. Everything else can follow
?>

<?

//header("Content-Type: text/plain");


/* set's the variables for MySQL connection */

$server = "localhost"; // this is the server address and port
$username = "root"; // change this to your username
$password = ""; // change this to your password

/* Connects to the MySQL server */

$link = @mysql_connect ($server, $username, $password)
or die (mysql_error());

/* Defines the Active Database for the Connection */

if (!@mysql_select_db("test", $link)) {
     echo "<p>There has been an error. This is the error message:</p>";
     echo "<p><strong>" . mysql_error() . "</strong></p>";
     echo "Please Contact Your Systems Administrator with the details";
}

$sql1 = mysql_query("SELECT id from users where loginname ='".$myusername."'",$link);

while($row=mysql_fetch_row($sql1 ))
{
                                   
#echo $result[0];
$uid=$row[0];
echo $uid;
#$uid=$result["id"];
#echo "$uid";

}

#$result2 = mysql_query("SELECT incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users WHERE (incidents.owner_id = users.id) AND (incidents.contact_id = '".$result[0]."')", $link);
$result2 = mysql_query("SELECT  incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users where (incidents.owner_id = users.id) OR (incidents.owner_id= NULL) AND (incidents.contact_id = '".$result[0]."')", $link);
#echo ("SELECT incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users WHERE (incidents.owner_id = users.id) OR (incidents.contact_id = '".$uid."')";
echo $result2 ;

#$result2 = mysql_query("SELECT incidents.id,incidents.description,users.firstname,users.surname,users.loginname from incidents,users where (incidents.owner_id = users.id) OR (incidents.contact_id =  '".$uid."')", $link);




if (!$result2) {
  echo("<p>Error performing query: " . mysql_error() . "</p>");
  exit();
}

/* Starts the table and creates headings */
?>
<table border="1">
<tr>
<td><strong>ID</strong></td>

<td><strong>Description</strong></td>
<td><strong>Owner Name</strong></td>
<td><strong>Notes</strong></td>

</tr> <td><strong>Description</strong></td>
<td><strong>Owner Name</strong></td>
<td><strong>Notes</strong></td></tr>
<?
/* Retrieves the rows from the query result set
and puts them into a HTML table row */
              




/* Retrieves the rows from the query result set
and puts them into a HTML table row */
#echo "hello";
#echo "$myusername";
while ($row = mysql_fetch_array($result2, MYSQL_ASSOC)) {


echo "\n";
     echo("<tr>\n<td>" . $row["id"] . "</td>");
    echo("<td>" . $row["description"] . "</td>");
    echo("<td>" . $row["firstname"] . $row["surname"]. "</td>");
    echo("<td>" . $row["loginname"] . "</td></tr>");

   # echo("<td>" . $row["name"] . "</td>");
   # echo("<td>" . $row["create_time"] . "</td>");
}

/* Closes the table */
?>
</table>
<?

/* Closes Connection to the MySQL server */
mysql_close ($link);

}
else
{
if($clicked=="closed")

{
echo "closed";
}
}

?>


Link to comment
Share on other sites

Cool...Before yu check yur mail I will explain you what I need .I have one colum having owner_id which the database says "NULL" . But Everytime I am trying to run query it is not taking NULL value.

All  attempted doing incident.owner_id = NULL to the query:

 

$result2 = mysql_query("SELECT incidents.id, incidents.description, users.firstname, users.surname, users.loginname FROM incidents,users WHERE (incidents.owner_id = users.id) OR (incidents.owner_id = NULL)AND (incidents.contact_id = '".$uid."')", $link);

 

Link to comment
Share on other sites

Forget all the above see what I actlly I want to:

Here's the new code snippet:
[code]
$sql1 = mysql_query("SELECT id from users where loginname ='".$myusername."'",$link);

In the above code I am storing the value in $sql1..Is it ok?

while($row=mysql_fetch_row($sql1 ))
{


$uid=$row[0];
echo $uid;



}

$result2 = mysql_query("SELECT  id, description  FROM incidents where contact_id = '".$uid."'", $link);

Now I need again to store this value in some variable and pass query within the output not from database.

while ($row1=mysql_fetch_row($result2))(
$uuid=$row1[0];
echo $uuid;

I know there is some mistake in the below code.Can I take the table structure not from database but from the last result and display it here.

[/code]

[color=red]$result3 = mysql_query("SELECT users.firstname,users.surname,incidents.owner_id FROM incidents,users where (incidents.owner_id = users.id) OR (incidents.owner_id = NULL)",$link);[/color]

I guess it would be like select """""" from <$row1[0] instead.


if (!$result3) {
  echo("<p>Error performing query: " . mysql_error() . "</p>");
  exit();
}

/* Starts the table and creates headings */
?>

 

All I want is store the ouput of table and then pass the query to saME TABLE.

PLS,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.