siric
-
Posts
116 -
Joined
-
Last visited
Posts posted by siric
-
-
I would recommend using a Content Management System (CMS). This will give you the framework and you can build your own pages, etc to suit. Joomla is good but in my option a bit too complex esp. to the beginner. I use PHP Fusion (www.php-fusion.co.uk). Simple to learn and very flexible.
-
You have the explode the wrong way around
should be
$file_name_array = explode(".", $newfile);
and
$final_name = $file_name_array[0].".".$file_name_array[1]; //was missing $ and correct concatenation
Don't forget your semicolons at the ends of the lines
-
A string would be easier for this method. You need to find the position of <head and </head>. You then replace all text between first and last string positions.
<? $text = "<head>This is a sentence one. This is sentence two.</head>"; $headstart = stripos($text, "<head>"); $headend = stripos($text, "</head>"); $textstart = $headstart + 6; //length of <head> is added $textend = $headend; $textlength = $textend - $textstart; $replacement = "This is the replacement text"; $newtext = substr_replace($text,$replacement,$textstart,$textlength); print "newtext - $newtext"; ?>
Hope this helps.
-
I gave the script a try as well and surely enough, Cisco routers come back as down even though I can ping them.
-
Access to the mysql database and access to your application are two totally different things.
Your application should login to the database with the mysql credentials. In that database you should have a users table which authenticates users and determines if they have the authority to add and delete rows.
So your user table would be something like this
user_id (auto increment)
username
password (use md5 when encryption)
privileges (0 for view only, 1 for add, 2 for add and delete, or whatever you choose)
Once a user has logged in, the while they have access to the table that holds the data, they do not have access to the entire mysql database.
Hope this helps.
-
The troubleshooting method that I use to check on queries is to print them. i.e where you have
$query = mysql_query("UPDATE carts Set admin_status = 5 WHERE 'cart_id' = .'$per'. 'cart_id'");
I do
$query = "UPDATE carts Set admin_status = 5 WHERE 'cart_id' = .'$per'. 'cart_id'"; print $query;
This allows me to
(1) ensure that the query is what I think it should be and
(2) run the query manually against my database and to check the results.
-
What is the problem that you are having exactly??
-
Run a phpinfo script to ensure that the mssql is showing up as being loaded
<?php phiinfo(); ?>
-
Have you stopped and restarted the webserver after you made the change in the php.ini file?
-
Since we do not have your database, can you tell us what happens when you run the code?
-
Hi,
I am working on a project and have come to a point where I need to run a script that runs a database query and then displays information and I will be calling this from different scripts. Question is would this entail an include or a function?
I know that with a function, I have the added capability of passing variables back and forth, but are there any other benefits/detriments to doing it one way over the other?
Or do I have it completely wrong??
Thanks
-
F1Fan,
Great. Just needed to swap around the divIds but works perfectly.
Much thanks.
SiRiC
-
Thanks F1Fan,
Is it possible that you can show some code as I am by no means a javascript expert.
thanks
-
Hi,
I want to create a form that has a conditional question, but cannot find anything anywhere to help.
Basically,
Do you () drive to work () use public transportation
If the answer is "use public transportation", I want to display another radio button question
Do you primarily use the
() train () bus () other
I understand that it can be done using Javascript and CSS,.
Can anyone assist?
Thanks
SiRiC
-
Ok, what I did was this
echo "<meta http-equiv='refresh' content='5; url=".$newpage." ' />\n";
as was suggested.
Because the redirect page has parameters that change,
could be
newpage.php?code=1234&poll=1 or newpage.php?code=32&poll=72
etc
I built the variable before the meta tags (did not know that you could do this), and it works.
Thanks to all.
-
ob_start(); echo "Your Message Here"; flush(); ob_end_flush(); sleep(3); header("Location: Page.php"); exit;
HTH
Teamatomic
Nope that did not work. Just brought a blank screen (or stayed on the one that was there before) for 3 seconds and then went to the called (2nd) page.
-
Hi,
I have been combing forums but cannot seem to get a answer that fits my problem.
I have a link that calls another page, writes to a table and redirects back to the first page.
I would like to output on the screen that the transaction has been completed, pause for a couple of seconds and then redirect to the first page.
I have used sleep() but all that does is to pause the calling of the second page and then call it and redirect immediately.
I have tried using flush before the sleep and before the echo but nothing works.
If I use
header("Refresh: 5; URL=firstpage.php");
all that does is to keep on calling the page repeatedly.
Any assistance would be appreciated.
Thanks
-
-
Hi,
I am pulling a variable call business name from a table and displaying it in a text box which can be edited.
My code to display it is
<p>Business Name <input type="text" name="business" size="30" value=<?print $business;?>>
However, if the business name contains more than one word, only the first word is displayed.
If I convert the whole line to php, like
<? print "<p>Business Name <input type='text' name='business' size='20' value='$business'>"; ?>
the whole name is displayed.
What am I doing wrong?
-
Hi,
I am inserting temporary values into a table for use on a resultset. Once I am done I want to clear the data out of the table and have used both
//clear tempbiz table $sqlClearBiz = "DELETE from tempbiz"; $resClearBiz = mysql_query($sqlClearBiz);
and
//clear tempbiz table $sqlClearBiz = "TRUNCATE tempbiz"; $resClearBiz = mysql_query($sqlClearBiz);
but neither work. However, I run the command in an SQl client, it works.
What can I check??
-
I would include print statements on $chcat[$i] and $cid before the comparision to see if there are any instances where the same. If not, then backtrack with print statement, until you find where the problem lies.
-
I am wondering, is it possible to get HTML elements with PHP....
Let's say, that some page has this HTML code:
<h1>This is my website</h1>.
Is it possible, that PHP check if that line exists in HTML code?
You can use
substr_count(string,substring,start,length)
Check http://www.w3schools.com/PHP/php_ref_string.asp
-
I do not know the schema for GoDaddy, but usually copying the file from a localhost verbatim will not work.
Try changing the hostname to "localhost".
-
I would start by breaking down the problem line since I find that double quotes can cause unnecessary stress.
Change
$query = mysql_query("SELECT Admin FROM Users WHERE Username = '$_SESSION['s_logged_n']' LIMIT 1") or die(mysql_error());
to
$s_logged_n = $_SESSION['s_logged_n']'; $query = mysql_query("SELECT Admin FROM Users WHERE Username = '$s_logged_n' LIMIT 1") or die(mysql_error());
Delete parts of string
in PHP Coding Help
Posted
Have a look at this thread.
http://www.phpfreaks.com/forums/index.php/topic,296528.msg1404407.html#msg1404407