Question here for you guys with knowledge on PHP capability

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

grabber_grabbs
Forum Commoner
Posts: 60
Joined: Mon Oct 10, 2011 6:13 pm

Question here for you guys with knowledge on PHP capability

Post by grabber_grabbs »

I am building my own Html web page for my buisness and while building it, i am questionning myself as how those big web site like Costco, Sears etc etc... how they manage their products listed on the site... price, description.... What if you have to edit the prices on a daily basis... or even on a weekly basis...

I have a buisness (hardware store) where i can have over 5000 different product.... Even if i am proud of what i have developped with HTML, all the pictures, prices and item info is stored into the HTml code... making it almost impossible to manage the prices and description because you have to edit the html code.... That would be ok for a small buisness with 30 differents items.... but not 5000.

the point of sale system we are using at the store can print a report for a given department on an excel file. (excel file could be converted to CSV easily)

So i would need to develop my html code to read the csv file on the server (pictureno,deptno, itemno, description, price, other info) and list this info on the monitor, one item below the other and so on until the end of file (csv)

That would be perfect and the only thing i would need to do, is to upload a file (csv) for each department on the server on a weekly basis, or even on a daily basis without problem.

What i want to know from you guys is where do i need to look for info on how to develop such thing. I have some pretty good knowledge in programming but not webprogramming. What kind of programming language would be needed ? Is PHP ok for this ?
I would have to read Excel or CSV only. Other file type would be too much work to keep up to date.
thanks for your suggestions.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Question here for you guys with knowledge on PHP capabil

Post by Celauran »

I think an SQL database would be better suited to the job than a CSV file. You could, of course, use a CSV file to update the database.
mikosiko
Forum Regular
Posts: 757
Joined: Wed Jan 13, 2010 7:22 pm

Re: Question here for you guys with knowledge on PHP capabil

Post by mikosiko »

most likely your POS already is based on some type of database, therefore integrate your website with it directly or with other DB could be a not so difficult task... check your POS software characteristic to find out how you can integrate it with your web site.
grabber_grabbs
Forum Commoner
Posts: 60
Joined: Mon Oct 10, 2011 6:13 pm

Re: Question here for you guys with knowledge on PHP capabil

Post by grabber_grabbs »

no to connect the website directly to my database its not an option. I like the SQL option.... if i can import my sql database with an excel file or csv, i see no problem.

So will PHP the language to use ? if so, is there any info here or where i can look to get some basic code or something to start with.

thanks.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Question here for you guys with knowledge on PHP capabil

Post by Celauran »

Are you at all familiar with SQL? If so, the PHP manual has some usage examples to help get you started.
grabber_grabbs
Forum Commoner
Posts: 60
Joined: Mon Oct 10, 2011 6:13 pm

Re: Question here for you guys with knowledge on PHP capabil

Post by grabber_grabbs »

Is it possible to do such thing.... html code embedded into php code ? if not, how would i make the html code to loop until the end of the sql file (managed with php code)

Code: Select all


<?php
while ( conditional statement is true){
	<html>
        <form>
         <input>
         </html>
}
?>

User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Question here for you guys with knowledge on PHP capabil

Post by Weirdan »

Yes, you can mix html and PHP, this is sometimes called 'native PHP templating'. For your own sanity I'd recommend to keep PHP logic in such files to a bare minimum though - you should process /prepare your data elsewhere, and only perform the most basic operations in templates: iterate over a collection of items, conditionally show some blocks, output data, etc.
Here's example displaying some basic shopping cart:

Code: Select all

<table>
<?php foreach ($cart as $item): ?>
<tr>
  <td><?=htmlspecialchars($item['id'])?></dt>
  <td><?=htmlspecialchars($item['name'])?></dt>
  <td><?=htmlspecialchars($item['price'])?></dt>
  <td><?=htmlspecialchars($item['qty'])?></dt>
</tr>
<?php endforeach; ?>
</table>
litebearer
Forum Contributor
Posts: 194
Joined: Sat Mar 27, 2004 5:54 am

Re: Question here for you guys with knowledge on PHP capabil

Post by litebearer »

Some easy to follow tutorials - http://www.tizag.com/phpT/
grabber_grabbs
Forum Commoner
Posts: 60
Joined: Mon Oct 10, 2011 6:13 pm

Re: Question here for you guys with knowledge on PHP capabil

Post by grabber_grabbs »

OK I did some search, and tests.... i am desprate !
Why all the demo i cut and paste on my software dreamweaver, when i try it, it doesnt give what it is suppose to give....
here is an example

ON the net, they have this example (this is to put some php code in a html document.)

<HTML>
<HEAD>
<TITLE>
this is a test
</TITLE>
</HEAD>
<BODY>

<?php
$d=date("D");
if ($d=="Fri") {
echo "Hello!<br />";
echo "Have a nice weekend!";
echo "See you on Monday!";
}
?>
</BODY>
</html>


Now here is the results
"; echo "Have a nice weekend!"; echo "See you on Monday!"; } ?>

I have tried tons and tons of different exemples...none of them works.
this is something basic here.... :lol: (but learning fast)
thanks for your help gal and guys.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Question here for you guys with knowledge on PHP capabil

Post by Celauran »

Was that a copy/paste of your PHP script? That should not produce any output at all (given that it's not Friday). Seeing the ?> is also worrisome, as it suggests that PHP may not be installed correctly. What (if any) output does this produce?

Code: Select all

<?php echo phpinfo(); ?>
grabber_grabbs
Forum Commoner
Posts: 60
Joined: Mon Oct 10, 2011 6:13 pm

Re: Question here for you guys with knowledge on PHP capabil

Post by grabber_grabbs »

OK could not find where i took that past exemple.....

Here is an other one.

<html>
<head></head>
<body class="page_bg">
Hello today is <?php echo date('l, F jS, Y'); ?>.
<?php echo "have a nice day"; ?>
</body>
</html>

My result is
Hello today is .

Can you cut an past the code above and try it....
Why i dont have at least the sentence have a nice day in the result

thanks again for helping a newbee like me...

why it is not working ?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Question here for you guys with knowledge on PHP capabil

Post by Celauran »

Code: Select all

Hello today is Wednesday, October 12th, 2011. have a nice day
Works fine for me.
User avatar
Weirdan
Moderator
Posts: 5978
Joined: Mon Nov 03, 2003 6:13 pm
Location: Odessa, Ukraine

Re: Question here for you guys with knowledge on PHP capabil

Post by Weirdan »

Why all the demo i cut and paste on my software dreamweaver, when i try it, it doesnt give what it is suppose to give....
How exactly you're trying it? Preview pane in DW?
grabber_grabbs
Forum Commoner
Posts: 60
Joined: Mon Oct 10, 2011 6:13 pm

Re: Question here for you guys with knowledge on PHP capabil

Post by grabber_grabbs »

Weirdan wrote:
Why all the demo i cut and paste on my software dreamweaver, when i try it, it doesnt give what it is suppose to give....
How exactly you're trying it? Preview pane in DW?
well i have an account with ipage.com where i host a little webpage for my brothers buisness. So i use this server to host the little program i make to learn PhP and html.
here is the link.

http://www.caraquetvacances.com/cart/test.html

even when i put the code on my DW software... i have the same results....

Why now ?
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Question here for you guys with knowledge on PHP capabil

Post by Celauran »

What if you change the file extension to .php?
Post Reply