nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Long time indeed!
Hmm.. I don't think its possible, because, when you submit upload_01.php, it will submit that particular script and not index.php. Well, I hope someone else has an answer to your question..

nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm.. I don't think you can do that. ie., textbox in index.php and file tag in upload_01.php . Why don't you have them both in upload_01.php ? This works for me.

//index.php
<?php
print_r($_POST);
?>
<table width="100%" border="0" cellpadding="5" cellspacing="0">
              <tr>
                <td align="left" valign="top"><iframe style="border:none;" src="upload_01.php" height="650" width="600"></iframe></td>
              </tr>
            </table>

and this is upload_01.php

<form method="post" action="index.php">
<table width="210" border="0" cellspacing="0" cellpadding="0">
  <tr>
  <td align="left" valign="top">Folder Name<input type="text" name="folderName" ></td>
    <td>Image 1<input type="file" name="image" id="image" onchange="javascript:form.submit()" /></td>
  </tr>
</table>
</form>
nav33n 472 Purple hazed! Team Colleague Featured Poster

As I can see from your insert query,

insert into helpdesk(email_id,firstName,lastName,phone,message) values

the column for email is email_id. But in your select query, you have email

$check = "select * from helpdesk where email='email_id'";

Next time, please use [code] tags to wrap your code.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Great ! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Simple..

$txtFname = isset($_POST['txtFname'])?$_POST['txtFname']:$contact['firstName'];
//if txtFname is set, then assign that value to $txtFname, else, assign $contact['firstName'] to $txtFname.

and then,

First Name: <input type="text" name="txtFname" value="<? echo $txtFname; ?>" /><br />
nav33n 472 Purple hazed! Team Colleague Featured Poster

I'm too old to learn any more new programming languages

You are never too old to learn something ;)
Anyways, the problem is fixed! So, Yaay! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

$LETTER = $_GET;

should be

$LETTER = $_GET['LETTER'];

P.S. using uppercase for variable names is not preferred by most programmers :)

nav33n 472 Purple hazed! Team Colleague Featured Poster
$filename = "test123.jpg";
$file = substr($filename,0,strpos($filename,"."));
echo $file;

You can do it this way too. But the problem is, if there is a . in the filename itself, for example, test.123.jpg , then this will return only test and not test.123 . The function given by allexxei is, I think, the best solution !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hmm.. Well, Thats because the limits are not being set properly.

if ($_GET[pg]==0)  $pg = 1;
  $lines = (int)$lines;
  if ($lines==0)  $lines = 5;
  $left_limit = ($_GET[pg]-1)*$lines;

This block of code is the one causing you the problem. :) If you are in page1, $_GET will not be set (ie., it will be null and not 0). I can't guarantee you that this will work, but you can try this.

if ($_GET['pg']=="" || $_GET['pg']==0){
     $pg = 1;
} else {
  $pg = $_GET['pg'];
}
  $lines = (int)$lines;
  if ($lines==0) {
    $lines = 5;
  }
  $left_limit = ($pg-1)*$lines;

:) Cheers,
Naveen

Cobber commented: Fixed my problem +4
nav33n 472 Purple hazed! Team Colleague Featured Poster

The 1st warning,

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/ozwww04/public_html/auction/yourfeedback.php on line 65

is because of this query.

SELECT f.*,a.title FROM PHPAUCTIONXL_feedbacks f
      LEFT OUTER JOIN PHPAUCTIONXL_auctions a
      ON a.id=f.auction_id
      WHERE rated_user_id='$secid' 
      ORDER by feedbackdate DESC 
      LIMIT $left_limit,$lines

Right after this query, you have $res=mysql_query ($sql); Instead, use $res=mysql_query ($sql) or die (mysql_error()); You will see why you are getting the warning.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Missing ending )
P.S. group is a keyword. Its not advisable to use keywords as column names.
This works fine for me.

$sql = "CREATE TABLE test.".$picurl ."
(name VARCHAR(200) NOT NULL ,
picurl VARCHAR( 200 ) NOT NULL ,
group1 VARCHAR( 200 ) NOT NULL ,
dateadded TIMESTAMP( 200 ) NOT NULL DEFAULT CURRENT_TIMESTAMP ,
id INT( 200 ) NOT NULL ,
PRIMARY KEY ( id ) ,UNIQUE (name ,picurl))";
nav33n 472 Purple hazed! Team Colleague Featured Poster

It doesn't matter if you have functions in a separate file and include it in the executing script.

Aaarghhhh ! :@ Do this.. I found the error !

function executequery($query) {
	$x = mysql_query($query) or die(mysql_error());
	return $x;
}

Assign mysql_query to a variable and return it. That works.. Indeed, return mysql_query($query) returns 1. :)

Edit : In my 1st example, I had assigned the value returned by mysql_query to a variable.. You missed it somehow ;)

OmniX commented: saved me again, thankyou :) +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

Yeah.. I am 100% sure..


Return Values

For SELECT, SHOW, DESCRIBE, EXPLAIN and other statements returning resultset, mysql_query() returns a resource on success, or FALSE on error.

For other type of SQL statements, INSERT, UPDATE, DELETE, DROP, etc, mysql_query() returns TRUE on success or FALSE on error.

The returned result resource should be passed to mysql_fetch_array(), and other functions for dealing with result tables, to access the returned data.

Use mysql_num_rows() to find out how many rows were returned for a SELECT statement or mysql_affected_rows() to find out how many rows were affected by a DELETE, INSERT, REPLACE, or UPDATE statement.

mysql_query() will also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query.

Source : http://in.php.net/mysql_query
You should get the desired output if you are using a simple select query. Well, what does your function queries return if you use update/delete query ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep. Thats the error. If you have update/delete/insert query, mysql_query will return 1 and its definitely not a valid resource. So, mysql_fetch_array / mysql_fetch_assoc wouldn't work. Try passing a select query to your function and see what it returns. It should return a resource :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are passing a wrong value to the function. Are you sure you are passing the result you get when you use mysql_query ?
ie., $result = mysql_query($query); I really think you are doing something wrong right there (the function is fine though!)

Edit: Check your queryFunction. See what it returns. Maybe its returning a wrong value ?

nav33n 472 Purple hazed! Team Colleague Featured Poster
while($row = mysql_fetch_array($result)) {
 $array[] = $row['name']; // this will assign the values of only the column "name" to the array $array.
}

AND

while($row = mysql_fetch_array($result)) {
 $array[] = $row; //this will assign the array $row to the array $array. 
}

I don't understand what is not working and I don't see any problem.. :S

nav33n 472 Purple hazed! Team Colleague Featured Poster
$tablename = "test";
$query = "create table ".$tablename." (name varchar(200) not null )";
mysql_query($query);

Like this.

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome :) !

nav33n 472 Purple hazed! Team Colleague Featured Poster

No.. You are creating an alias for SUBSTRING_INDEX(tip, ' ',8) . Php parser will look for a column name and since you aren't specifying any, it will be empty.

SUBSTRING_INDEX(tip, ' ',8) as tip

This will return the result under "user defined" column name tip, so that php parser can access it.

antwan1986 commented: Very useful! +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

Ah!!! You can do it this way.

$query = "SELECT SUBSTRING_INDEX(tip,' ',8) as tip  FROM tips";

This will solve your problem, I am sure.

nav33n 472 Purple hazed! Team Colleague Featured Poster

I use devphp. It has some bugs, but still, its good ! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Specify td width.

<tr>
<td width=33%><?php include "1.html"; ?></td><td width=33%><?php include "2.html"; ?></td><td width=33%><?php include "3.html"; ?></td>
</tr>
nav33n 472 Purple hazed! Team Colleague Featured Poster

You can find alot of projects in hotscripts.com .

nav33n 472 Purple hazed! Team Colleague Featured Poster

Umm.. wouldn't it be better if you post your question in Java forum ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hmm.. Execute the query

SELECT SUBSTRING_INDEX(tip,' ',8) FROM tips;

in phpmyadmin/mysql console and see if you get any output ! Maybe there are no records in the table with more than 7 spaces.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Well, yes, sessions, but is there way to save user identification for long time? (except session in database/files/cookies)

Maybe some new clever way? I know the ordinary one's.

I don't think so..

nav33n 472 Purple hazed! Team Colleague Featured Poster

Where are you assigning a value to $count, $delete and $checkbox ? If register globals are turned on(which is off by default), $checkbox and $delete will work.
Does it even enter this condition ?

for($i=0;$i<$count;$i++){
$del_userid = $checkbox[$i];
$sql = "DELETE FROM contacts WHERE userid='$del_userid'";
$res = mysql_query($sql);
}

And, you should use $_POST in Rob's code.

$query = "delete from table where userid in(" . implode(",", $_POST['checkbox']) . ")";
nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Cool !

nav33n 472 Purple hazed! Team Colleague Featured Poster
$string = $string = implode(",",$_POST['checkboxarray']);
$query = "insert into table (columnname) values ('$string')";
mysql_query($query);

But wouldn't it cause a problem ? If you want to retrieve the values and display again the selected values, you have to fetch the row from the table, explode it to an array and then see if a particular sport is in this array. If yes, then "check" it, else, do nothing!

nav33n 472 Purple hazed! Team Colleague Featured Poster

You are welcome :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

How do you want to save it in the table ? comma separated selected values in one row ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Sigh :confused:

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep.. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster
select SUBSTRING_INDEX(description," ",3) from table [where condition];

description = column name
" " = delimiter
3 = count
For example, if we apply the above query to the following text,

This is an example of substring_index.

it returns,

This is an

Umm.. Clear enough ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Instead of

if ($uname != $dbunames)

You can do,

if(mysql_num_rows($dbunames) > 0 ) { //check if there is already an entry for that username
 echo "Already taken";
} else {
//insert to table
}
nav33n 472 Purple hazed! Team Colleague Featured Poster

How do I use the calendar?

The calendar functions in a way similar to the forums in that there can be multiple calendars. One calendar could hold just events that you are able to see, while another may list birthdays.

There are two types of events on the calendar: normal events and recurring events.

Normal Events span the time frame from when the event starts until the event ends.

Recurring Events repeat over a set period of time based on certain criteria. Examples would be an event that occurs on the first Monday of every month and an event that occurs every Monday and Wednesday.

The administrator may have enabled registered members to post events, but usually this is not the case. You can most likely post your own private events that are only viewable to you.

Birthdays may be shown on the calendar if the administrator has enabled this feature. Your birthday will automatically be shown on the calendar if you have entered the date of your birthday in your profile. Note: if you do not enter the year of your birth when you edit your profile, your age will not be shown on the calendar.

If you enter your birthday, your name will also appear on the main forum page when it is your birthday.

http://www.daniweb.com/forums/calendar.php

Try "search" next time. :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

No... No ...
I already sent some replies for solved threads
please check once with your account

Does that make any sense ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

Can you post the latest code (complete code) ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

:) Okay ! Goodnite!

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yeah.. To reuse your code, functions are always good.. And, the function works fine for me..

nav33n 472 Purple hazed! Team Colleague Featured Poster

Lol..I am not a guru :D ! There are people here who knows php much better than I do.

nav33n 472 Purple hazed! Team Colleague Featured Poster

As I have shown you in my example, where I am assigning $row to $array (which is an array), you can do the same !
You can do,

function fetchAssoc($sql) {
$array = array();
while($row = mysql_fetch_assoc($sql)) {
$array[] = $row;
}
return $array;
}

Then iterate through $array.

OmniX commented: php guru to the rescue! +1
nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep ! Have a while loop, insert the values to an array and return the array.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Yep. It will work. But it will return only 1 record, that is the first one (in mysql_fetch_assoc).

nav33n 472 Purple hazed! Team Colleague Featured Poster

It doesn't really matter if you are using mysql_fetch_assoc or mysql_fetch_array. The problem with your function is, you don't have mysql_query in it. So, it will not execute the query at all ! :)
You can do it this way.

$query = "select * from table";
$result = fetchAssoc($query);

function fetchAssoc($sql) {
$result = mysql_query($sql);
 return mysql_fetch_assoc($result) or die("Error!!!");
}
nav33n 472 Purple hazed! Team Colleague Featured Poster
<?php
$connection = Connection();
$query = "select * from attend";
$result = executequery($query);
while($row = mysql_fetch_array($result)) {
	print "<pre>";
	print_r($row);
	print "</pre>";
}
print "<br />";
$result2 = executequeryandreturnrows($query);
print "<pre>";
print_r($result2);
print "</pre>";
function Connection() {
	$conn = mysql_connect("localhost","root");
	mysql_select_db("test");
	return $conn;
}
function executequery($query) {
	$result = mysql_query($query);
	return $result;
}
function executequeryandreturnrows($query) {
	$result = mysql_query($query);
	$array = array();
	while($row = mysql_fetch_array($result)) {
		$array[] = $row['name'];
	}
	return $array;
}
?>

In the above example, I have 3 functions. One for connection(which is pretty straightforward), the second returns the resultset and the third returns the array result.

nav33n 472 Purple hazed! Team Colleague Featured Poster

Hmm.. Well, It depends on your function definition. Can you post relevant code so that we can take a look ?

nav33n 472 Purple hazed! Team Colleague Featured Poster

You have something wrong in your query. Echo the query and execute it in phpmyadmin/mysql console. You will see the problem! :)

nav33n 472 Purple hazed! Team Colleague Featured Poster

Phew! Congrats !

nav33n 472 Purple hazed! Team Colleague Featured Poster

Ah! cool.. :)