iam new in php but i am trying to do my first project maby it is small for some of you but it is big step for me :
iam trying to build advrtising magzine with articals i have to join both of theme in one page the artical and the advritisisng same as the printed one so i think that i have to creat tow table
the first one call adv conatain this filed
1-id 2-isuue 3-col 4-img
second the artical table
1-id 2-isuue 3-col 4-text

then i have to bulid php program to control the data base i will but all the details here in the web site tell me if you want me to put it and we can shre the the thoughts . as i told you this my first program so maby there will be huge mistakes

Dani AI

Generated

Good start from — the problem statement (mixing editorial content and paid placements on a single page) is the important bit. is right: build a tiny, working prototype first. 's request for code is practical; small, focused snippets make it far easier to diagnose issues.

A practical architecture: keep issue-level metadata in its own table, and drive rendering from a single content table that has a content type (article or ad), an issue reference, a placement indicator (column/position), and either text or a pointer to an image file. Storing image files on disk (or object storage) and saving paths in the DB simplifies backups and avoids bloated BLOBs. Index the columns you use in WHERE/ORDER BY so page assembly is fast.

Use parameterized queries (PDO) to avoid SQL injection and simplify error handling. Example pattern:

$pdo = new PDO('mysql:host=localhost;dbname=mydb', 'user', 'pass', [
    PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION
]);
$stmt = $pdo->prepare('SELECT * FROM content WHERE issue_id = ? ORDER BY column_index, position');
$stmt->execute([$issueId]);
$items = $stmt->fetchAll(PDO::FETCH_ASSOC);

Validate and sanitize file uploads (size, MIME via getimagesize, extension), store files outside the webroot when possible, and escape output for HTML with htmlspecialchars. See PHP PDO prepared statements and the file upload guide for implementation details: PDO prepared statements and Handling file uploads.

Recommended Answers

All 2 Replies

Okay so have you written any code?

Show us whatever you've done so far.

Sounds like you've got a pretty good start, and your database is at least begun to be laid out. Start small, and get little things working first. My version 0.1 of the blog software I wrote is only about 12 PHP scripts, not very much by any means.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.