-
Posts
488 -
Joined
-
Last visited
Posts posted by chriscloyd
-
-
so if i do it the way u show i can call it up like this
[CODE]
<?php
$project = new getproject();
echo $project->p_name();
?>
[/CODE] -
ya but how do u do the things like $project = new getproject
i have looked for tutorials but cant find any -
how about u try
$_SESSION['member'] or $_SESSION['nonmember']
-
would this be how to start a class if im trying to get an id from a url
say if my url is index.php?project=3 <=== that 3 is the id
how do i echo the class to get the $p_name
[code]
<?php
class getproject {
var $id = $_GET['project'];
function p_name {
$get_name = mysql_query("SELECT * FROM projects WHERE id = '$id'") or die(mysql_error());
$p = mysql_fetch_assoc($get_name);
$p_name = $p['name'];
}
}
?>
[/code] -
my function is not displaying anything
okay heres my function
[code]
<?php
function get_project($i) {
$get_project = mysql_query("SELECT * FROM projects WHERE id = '$i'") or die(mysql_error());
$p = mysql_fetch_assoc($get_project) or die(mysql_error());
$p_name = $p['title'];
$p_type = $p['type'];
$p_startdate = $p['startdate'];
return $p_type;
return $p_name;
return $p_startdate;
if ($p['status'] != 'Completed') {
$p_status = 'In Progress';
return $p_status;
} else {
$p_status = 'Completed';
$p_enddate = $p['enddate'];
return $p_status;
return $p_enddate;
}
}
?>
[/code]
heres my code calling the function
[code]
<?php
session_start();
include("config.php");
include("includes/porfolio_getfunctions.php");
if (isset($_GET['project'])){
$id = $_GET['project'];
get_project($id);
echo $p_name;
echo $p_type;
}
?>
[/code] -
no sorting at all
-
Im trying to make a link where people can order their mysql query from
heres my links
[code]
<a href="?sort=id">ID</a> <a href="?sort=first, last">Name</a> <a href="?sort=position">Position</a> <a href="?sort=email">Email</a> <a href="?sort=level">Level</a> - <a href="?type=ASC">ASC</a> <a href="?type=DESC">DESC</a>
[/code]
heres my code
[code]
<?php
if ($_GET['sort']) {
$sort = $_GET['sort'];
} else {
$sort = 'id';
}
if ($_GET['type']) {
$type = $_GET['type'];
} else {
$type = 'ASC';
}
$get_all_staff = mysql_query("SELECT * FROM users WHERE level IN('admin','support','sales','staff') ORDER BY '$sort' '$type'");
?>
[/code] -
how do i make like a percent bar say if we have 33 task to do on a project and we have 21 done
how could i go about making a bar show that its 63% complete
i have the whole rest of the project management script done im just having trouble with makeing the image -
see i have that and it works fine but the problem im getting is saving all of them in one variable so i can add it to the database
-
yes but when i go to enter it into a database will it have them all under the variable value
-
i just dont see how i can get each of the selctions into one variable
-
yes i know that im not missing the point i understand that
now im trying to do the foreach loop
[code]
<?php if(isset($_POST['test'])){
$a = $_POST['test[]'];
foreach ($a) {
$services .= $a.'<br />';
}
}
?>
[/code] -
no its printitng out three i choose
its shoing the Array ( [test] => Array ( [0] => 1 [1] => 4 [2] => 5 ) [Submit] => Submit )
that on my tes form but i want it to show the info like this
1
4
5
-
how do i make it print so its not like this Array ( [test] => 6 [Submit] => Submit )
but like this
Web Design
Logo Design -
i tried that and i got this
Array ( [test] => 6 [Submit] => Submit )
so how do i make it so it saves all of the things from the array in one var so i can save it into the database -
thats not the problem curtis its the services field
how would i access it like an array -
heres my problem when i retrive the form with my php script its not showing multiple services from the services field so if i select more than one its not working it will only show the top one
how do i fix it ?
heres my form
[code]
<form id="form1" name="form1" method="post" action="includes/send_quote.php">
<table width="253" border="0" cellspacing="5" cellpadding="0">
<tr>
<td valign="middle"><div align="right" class="style17">First Name</div></td>
<td><div align="center" class="style17">*</div></td>
<td><input name="FirstName" type="text" class="input2" id="FirstName" /></td>
</tr>
<tr>
<td valign="middle"><div align="right" class="style17">Last Name </div></td>
<td><div align="center" class="style17">*</div></td>
<td><input name="LastName" type="text" class="input2" id="LastName" /></td>
</tr>
<tr>
<td valign="middle"><div align="right" class="style17">Phone # </div></td>
<td><div align="center" class="style17">*</div></td>
<td><input name="PhoneNumber" type="text" class="input2" id="PhoneNumber" /></td>
</tr>
<tr>
<td valign="middle"><div align="right" class="style17">Email</div></td>
<td><div align="center" class="style17">*</div></td>
<td><input name="EmailAddress" type="text" class="input2" id="EmailAddress" /></td>
</tr>
<tr>
<td valign="middle"><div align="right" class="style17">Budget </div></td>
<td><div align="center"><span class="style8"><span class="style8"><span class="style11"><span class="style19"></span></span></span></span></div></td>
<td><span class="style17">
<label>
<select name="budget" id="budget">
<option value="< $100">< $100</option>
<option value="$100 - $200" selected>$100 - $200</option>
<option value="$200 - $300">$200 - $300</option>
<option value="$300 - $400">$300 - $400</option>
<option value="$400 - $500">$400 - $500</option>
<option value="$500 - $600">$500 - $600</option>
<option value="$600 - $700">$600 - $700</option>
<option value="$700 - $800">$700 - $800</option>
<option value="$800 - $900">$800 - $900</option>
<option value="$800 - $900">$800 - $900</option>
<option value="$1000 - $2000">$1000 - $2000</option>
<option value="$2000 - $3000">$2000 - $3000</option>
<option value="$3000+">$3000+</option>
</select>
</label>
</span></td>
</tr>
<tr>
<td valign="middle"><div align="right" class="style17">URL</div></td>
<td><div align="center"><span class="style8"><span class="style8"><span class="style11"><span class="style19"></span></span></span></span></div></td>
<td><input name="url" type="text" class="input2" id="url" /></td>
</tr>
<tr>
<td width="60" rowspan="2" valign="top"><div align="right" class="style17">Service</div>
<span class="style17">Use Ctrl
to select
more than one</span></td>
<td valign="top"><div align="center"><span class="style8"><span class="style8"><span class="style11"><span class="style19"></span></span></span></span></div></td>
<td width="164" rowspan="2" valign="top"><span class="style17">
<select name="services" size="4" multiple="multiple" id="services">
<option value="Web Desgin">Web Desgin</option>
<option value="Logo/Branding Design">Logo/Branding Design</option>
<option value="Web Development">Web Development</option>
<option value="Other">Other</option>
</select>
</span></td>
</tr>
<tr>
<td valign="top"><div align="center"><span class="style8"><span class="style8"><span class="style11"><span class="style19"></span></span></span></span></div></td>
</tr>
<tr>
<td valign="middle"><div align="right" class="style17">If Other </div></td>
<td><div align="center"><span class="style8"><span class="style8"><span class="style11"><span class="style19"></span></span></span></span></div></td>
<td><input name="other2" type="text" class="input2" id="other2" /></td>
</tr>
<tr>
<td valign="middle"><div align="right" class="style17">Description</div></td>
<td> </td>
<td> </td>
</tr>
<tr>
<td colspan="3"><div align="center" class="style17">
<textarea name="description" cols="25" rows="5" class="style21" id="description"></textarea>
</div></td>
</tr>
<tr>
<td><div align="right" class="style17">Refered By </div></td>
<td> </td>
<td><span class="style17">
<select name="refered">
<option value="">Select One</option>
<?php
$sales = mysql_query("select * from users where level in ('sales','admin') order by first, last asc");
while ($s = mysql_fetch_assoc($sales)) {
echo '<option value="'.$s['id'].'">'.$s['first'].' '.$s['last'].'</option>';
}
?>
</select>
</span> </td>
</tr>
<tr>
<td width="60"><input name="date" type="hidden" value="<?php echo date("n/j/Y g:i:s A"); ?>" /></td>
<td width="9"><div align="center"><span class="style8"><span class="style8"><span class="style11"><span class="style19"></span></span></span></span></div></td>
<td width="164"><span class="style17">
<label>
<input name="Submit" type="submit" class="input" onClick="MM_validateForm('FirstName','','R','LastName','','R','PhoneNumber','','RisNum','EmailAddress','','RisEmail');return document.MM_returnValue" value="Get Quote" />
</label>
</span></td>
</tr>
</table>
</form>
[/code] -
ya it does
-
im trying to change the file permissions using chmod so i can unlink a file but how do i go ahead and do that
this is the error i have with my code
[code]
<?php
mysql_connect('localhost','www5965_chris','chriscloyd');
mysql_select_db('www5965_chris');
$id = $_GET['id'];
$query = mysql_query("SELECT name, type, size, path FROM upload2 WHERE id = '$id'");
while($test = mysql_fetch_array($query)) {
$ftp_user_name = 'www5965@christophercloyd.com';
$ftp_user_pass = '596511';
$ftp_root = '/';
$ftp_server = 'localhost';
$conn_id = ftp_connect($ftp_server);
$login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
chmod("upload_test/".$test['name'],0777);
unlink("upload_test/".$test['name']);
}
?>
[/code]
this is the error im getting
Warning: chmod() [function.chmod]: No such file or directory in /usr/home/www/public_html/delete.php on line 13
Warning: unlink(upload_test/steam.exe) [function.unlink]: No such file or directory in /usr/home/www/public_html/delete.php on line 14
-
this is my create mail class
[code]
<?php
class cpmail{
var $cpuser;
var $cppass;
var $cpdomain;
var $cpskin;
function cpmail($cpuser,$cppass,$cpdomain,$cpskin='x'){
$this->cpuser=$cpuser;
$this->cppass=$cppass;
$this->cpdomain=$cpdomain;
$this->cpskin=$cpskin;
}
function create($euser,$epass,$equota){
$path="http://".$this->cpuser.":".$this->cppass."@".$this->cpdomain.":2082/frontend/".$this->cpskin."/mail/doaddpop.html?quota=".$equota."&email=".$euser."&domain=".$this->cpdomain."&password=".$epass;
$f = fopen($path,"r");
if (!$f) {
return('Cannot create email account. Possible reasons: "fopen" function not allowed on your server, PHP is running in SAFE mode');
}
while (!feof ($f)) {
$line = fgets ($f, 1024);
if (ereg ("already exists!", $line, $out)) {
return('Such email account already exists.');
}
}
fclose($f);
return "Email account created.";
}
}
?>
[/code]
im getting this error
Warning: fopen(http://...@srxstudios.com:2082/frontend/X v2.6.0/mail/doaddpop.html?quota=20&email=******&domain=******&password=******) [function.fopen]: failed to open stream: HTTP request failed! HTTP/1.0 404 Not Found in /home/srxstud/public_html/test22/admin/cpmail_class.php on line 15
Cannot create email account. Possible reasons: "fopen" function not allowed on your server, PHP is running in SAFE mode
heres my code that calls it
[code]
<?php
include('cpmail_class.php');
$cpanel = new cpmail("*****","*******","*****","X v2.6.0");
echo cpanel->create($_POST['email'],$_POST['password'],"20");
?>
[/code]
how could i take safe mode off if i dont ahve access to the php.ini
-
would this work if i want to get three different types of rows from one column
$get_staff = mysql_query("SELECT * FROM users WHERE level = ('admin','staff','sales')") -
oh my bad i did not read the first part
-
[CODE]
<?php
$result = mysql_query($mysql_connect, $query) or die (mysqli_error($mysql_connect));
?>
[/CODE]
or try this
[CODE]
<?php
$result = mysql_query($query, $mysql_connect) or die (mysqli_error($mysql_connect));
?>
[/CODE]
in ur original one u had an i after mysqli -
$result = mysqli_query($query, $mysql_connect) or die (mysqli_error($mysql_connect));
php class
in PHP Coding Help
Posted
Parse error: parse error, unexpected T_VARIABLE in C:\Program Files\Apache Software Foundation\Apache2.2\htdocs\includes\porfolio_getfunctions.php on line 3
[CODE]
<?php
class getproject {
var $id = $_GET['project'];
//project name
function name() {
if ($result = mysql_query("SELECT `title` FROM projects WHERE id = '{$this->id}'")) {
if (mysql_num_rows($result) > 0) {
$row = mysql_fetch_assoc($result);
return $row['name'];
}
}
}
}
?>
[/CODE]